linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Markus Trippelsdorf <markus@trippelsdorf.de>
To: Lukas Czerner <lczerner@redhat.com>
Cc: Theodore Ts'o <tytso@mit.edu>,
	Andreas Dilger <adilger.kernel@dilger.ca>,
	linux-ext4@vger.kernel.org,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org
Subject: Re: mounting with lazytime doesn't work on ext4
Date: Tue, 19 Sep 2017 16:55:37 +0200	[thread overview]
Message-ID: <20170919145537.GA211@x4> (raw)
In-Reply-To: <20170919144617.wh4raizggvwjpolg@rh_laptop>

On 2017.09.19 at 16:46 +0200, Lukas Czerner wrote:
> On Tue, Sep 19, 2017 at 10:35:06AM +0200, Markus Trippelsdorf wrote:
> > On 2017.09.18 at 21:26 +0200, Markus Trippelsdorf wrote:
> > > I switched back to ext4 yesterday, because my btrfs fs got corrupted.
> > > However mounting with lazytime doesn't work, neither specifying it in
> > > /etc/fstab nor a manual remount. It looks like the option is simply
> > > ignored.
> > > 
> > > Strace shows, e.g.:
> > > 
> > >  # mount -o lazytime /boot
> > > mount("/dev/sdc2", "/boot", "ext4", MS_LAZYTIME, NULL) = 0 
> > > EXT4-fs (sdc2): mounted filesystem with ordered data mode. Opts: (null) 
> > > /dev/sdc2 on /boot type ext4 (rw,relatime,data=ordered)
> > > 
> > >  # mount -o remount,lazytime /var
> > > mount("/dev/sdb2", "/var", 0x12c4460, MS_REMOUNT|MS_NOATIME|MS_LAZYTIME, NULL) = 0 
> > > EXT4-fs (sdb2): re-mounted. Opts: (null)
> > > /dev/sdb2 on /var type ext4 (rw,noatime,data=ordered)
> > > 
> > > When I set "sb->s_flags |= MS_LAZYTIME;" unconditionally in
> > > fs/ext4/super.c:5057 (just deleting the if statement), then lazytime
> > > gets used when I remount.
> > > 
> > > I'm running the latest git tree (4.14.0-rc1).
> > 
> > The following patch seems to fix the issue for remounts:
> > 
> > diff --git a/fs/namespace.c b/fs/namespace.c
> > index 54059b142d6b..d0b386706c5b 100644
> > --- a/fs/namespace.c
> > +++ b/fs/namespace.c
> > @@ -2322,6 +2322,9 @@ static int do_remount(struct path *path, int ms_flags, int sb_flags,
> >  	if (err)
> >  		return err;
> >  
> > +	if (mnt_flags & MS_LAZYTIME)
> > +		sb_flags |= MS_LAZYTIME;
> > +
> >  	down_write(&sb->s_umount);
> >  	if (ms_flags & MS_BIND)
> >  		err = change_mount_flags(path->mnt, ms_flags);
> > @@ -2809,6 +2812,8 @@ long do_mount(const char *dev_name, const char __user *dir_name,
> >  		mnt_flags &= ~(MNT_RELATIME | MNT_NOATIME);
> >  	if (flags & SB_RDONLY)
> >  		mnt_flags |= MNT_READONLY;
> > +	if (flags & MS_LAZYTIME)
> > +		mnt_flags |= MS_LAZYTIME;
> 
> Hi,
> 
> this is definitely not right. Currently it seems that MS_LAZYTIME is
> supposed to be per sb option, even though I do not see a reason why it
> should not be per mnt options, in fact I'd prefer that.
> 
> However the problem happened when
> e462ec50cb5fad19f6003a3d8087f4a0945dd2b1 switched from masking out per
> mnt flags to masking in per sb flags. However David missed SB_LAZYFLAG.
> The fix should be easy like this:

Yes. I already send the identical patch. Please see:
https://lkml.org/lkml/2017/9/19/186

-- 
Markus

      reply	other threads:[~2017-09-19 14:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20170918192644.GA232@x4>
2017-09-19  8:35 ` mounting with lazytime doesn't work on ext4 Markus Trippelsdorf
2017-09-19 10:18   ` [PATCH] VFS: Handle lazytime in do_mount() Markus Trippelsdorf
2017-09-19 10:37     ` [PATCH v2] " Markus Trippelsdorf
2017-09-19 15:25       ` Lukas Czerner
2017-09-30  7:10         ` Markus Trippelsdorf
2017-09-19 14:46   ` mounting with lazytime doesn't work on ext4 Lukas Czerner
2017-09-19 14:55     ` Markus Trippelsdorf [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170919145537.GA211@x4 \
    --to=markus@trippelsdorf.de \
    --cc=adilger.kernel@dilger.ca \
    --cc=lczerner@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).