lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <003901d642c0$832b10c0$89813240$@samsung.com>
Date:   Mon, 15 Jun 2020 11:56:05 +0900
From:   "Namjae Jeon" <namjae.jeon@...sung.com>
To:     "'Hyunchul Lee'" <hyc.lee@...il.com>
Cc:     <linux-fsdevel@...r.kernel.org>,
        "'LKML'" <linux-kernel@...r.kernel.org>,
        "'Sungjong Seo'" <sj1557.seo@...sung.com>
Subject: RE: [PATCH 1/2] exfat: call sync_filesystem for read-only remount

> Hi Namjae,
> 
> 2020년 6월 15일 (월) 오전 9:14, Namjae Jeon <namjae.jeon@...sung.com>님이 작성:
> >
> > Hi Hyunchul,
> > > We need to commit dirty metadata and pages to disk before remounting exfat as read-only.
> > >
> > > This fixes a failure in xfstests generic/452
> > Could you please elaborate more the reason why generic/452 in xfstests failed ?
> 
> xfstests generic/452 does the following.
> cp /bin/ls <exfat>/
> mount -o remount,ro <exfat>
> 
> the <exfat>/ls file is corrupted, because while exfat is remounted as read-only, exfat doesn't have a
> chance to commit metadata and vfs invalidates page caches in a block device.
Got it.
> 
> I will put this explanation in a commit message.
Good.
> 
> > >
> > > Signed-off-by: Hyunchul Lee <hyc.lee@...il.com>
> > > ---
> > >  fs/exfat/super.c | 19 +++++++++++++++++++
> > >  1 file changed, 19 insertions(+)
> > >
> > > diff --git a/fs/exfat/super.c b/fs/exfat/super.c index
> > > e650e65536f8..61c6cf240c19 100644
> > > --- a/fs/exfat/super.c
> > > +++ b/fs/exfat/super.c
> > > @@ -693,10 +693,29 @@ static void exfat_free(struct fs_context *fc)
> > >       }
> > >  }
> > >
> > > +static int exfat_reconfigure(struct fs_context *fc) {
> > > +     struct super_block *sb = fc->root->d_sb;
> > > +     int ret;
> > int ret = 0;
> > > +     bool new_rdonly;
> > > +
> > > +     new_rdonly = fc->sb_flags & SB_RDONLY;
> > > +     if (new_rdonly != sb_rdonly(sb)) {
> > If you modify it like this, would not we need new_rdonly?
> >         if (fc->sb_flags & SB_RDONLY && !sb_rdonly(sb))
> >
> This condition means that mount options are changed from "rw" to "ro", or "ro" to "rw".
> 
> > > +             if (new_rdonly) {
> 
> And this condition means these options are changed from "rw" to "ro".
> It seems better to change two conditions to the one you suggested, or remove those. because
> sync_filesystem returns 0 when the filesystem is mounted as read-only.
The latter would be fine.
> 
> > > +                     /* volume flag will be updated in exfat_sync_fs */
> > > +                     ret = sync_filesystem(sb);
> > > +                     if (ret < 0)
> > > +                             return ret;
> > I think that this ret check can be removed by using return ret; below ?
> 
> Okay, I will apply this.
> Thank you for your comments!
Thanks for your patch!
> 
> 
> > > +             }
> > > +     }
> > > +     return 0;
> > return ret;
> > > +}
> > > +
> > >  static const struct fs_context_operations exfat_context_ops = {
> > >       .parse_param    = exfat_parse_param,
> > >       .get_tree       = exfat_get_tree,
> > >       .free           = exfat_free,
> > > +     .reconfigure    = exfat_reconfigure,
> > >  };
> > >
> > >  static int exfat_init_fs_context(struct fs_context *fc)
> > > --
> > > 2.17.1
> >
> >


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ