Skip to contentSkip to conversation

Lazytime undone by/not working with remount?

DISCUSSION Holger Hoffstätte 4 participants 7 messages May 16, 2015 – May 18, 2015 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hi,

playing with lazytime on 4.0.4-rc1 + yesterday's fencepost patch) I noticed something odd. Mounting secondary (non-root) partitions with lazytime works fine, but / does not seem to retain the value from fstab - apparently because it is remounted rw during boot, and lazytime gets swallowed/undone.

Same effect when trying to remount manually with lazytime:

tux>findmnt /
TARGET SOURCE FSTYPE OPTIONS
/ /dev/sda1 ext4 rw,noatime

tux>mount -o lazytime,remount /

tux>dmesg

[ 5208.482505] EXT4-fs (sda1): re-mounted. Opts: (null)

tux>findmnt /
TARGET SOURCE FSTYPE OPTIONS
/ /dev/sda1 ext4 rw,noatime

tux>mount --version
mount from util-linux 2.26.2 (libmount 2.26.0: assert, debug)

Newly mounting unmounted partitions works fine.

Any ideas?

Holger

#1 lore raw

(cc: kzak)

Quoted 22 lines · Holger Hoffstätte

Hi,

playing with lazytime on 4.0.4-rc1 + yesterday's fencepost patch) I noticed something odd. Mounting secondary (non-root) partitions with lazytime works fine, but / does not seem to retain the value from fstab - apparently because it is remounted rw during boot, and lazytime gets swallowed/undone.

Same effect when trying to remount manually with lazytime:

tux>findmnt /
TARGET SOURCE FSTYPE OPTIONS
/ /dev/sda1 ext4 rw,noatime

tux>mount -o lazytime,remount /

tux>dmesg

[ 5208.482505] EXT4-fs (sda1): re-mounted. Opts: (null)

tux>findmnt /
TARGET SOURCE FSTYPE OPTIONS
/ /dev/sda1 ext4 rw,noatime

Quoted 6 lines

tux>mount --version
mount from util-linux 2.26.2 (libmount 2.26.0: assert, debug)

Newly mounting unmounted partitions works fine.

Any ideas?

This turned out to be a regression in util-linux 2.26.x. :-( I downgraded to 2.25.2 and behold:

tux>findmnt /
TARGET SOURCE FSTYPE OPTIONS
/ /dev/sda1 ext4 rw,noatime

tux>mount -o remount,lazytime /

root>findmnt /
TARGET SOURCE FSTYPE OPTIONS
/ /dev/sda1 ext4 rw,noatime,lazytime

Sorry for the noise.

Holger

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
In reply to a message not in the archive
Quoted 20 lines · Holger Hoffstätte
Quoted 20 lines

playing with lazytime on 4.0.4-rc1 + yesterday's fencepost patch) I noticed something odd. Mounting secondary (non-root) partitions with lazytime works fine, but / does not seem to retain the value from fstab - apparently because it is remounted rw during boot, and lazytime gets swallowed/undone.

Same effect when trying to remount manually with lazytime:

tux>findmnt /
TARGET SOURCE FSTYPE OPTIONS
/ /dev/sda1 ext4 rw,noatime

tux>mount -o lazytime,remount /

tux>dmesg

[ 5208.482505] EXT4-fs (sda1): re-mounted. Opts: (null)

tux>findmnt /
TARGET SOURCE FSTYPE OPTIONS
/ /dev/sda1 ext4 rw,noatime

Quoted 8 lines
Quoted 6 lines

tux>mount --version
mount from util-linux 2.26.2 (libmount 2.26.0: assert, debug)

Newly mounting unmounted partitions works fine.

Any ideas?

This turned out to be a regression in util-linux 2.26.x. :-(

I don't think so. Try strace, for example:

 # strace -e mount mount -o lazytime,remount /home/archive
 mount("/dev/sdb1", "/home/archive", 0xcf1210, MS_REMOUNT|0x2000000, NULL) = 0
                                                          ^^^^^^^^^
                           (1<<25) aka 0x2000000 is MS_LAZYTIME

The util-linux since version 2.26.2 supports MS_LAZYTIME flag.

I see the problem on another place. The ext4 fs driver has unique feature that it's able to accept "lazytime" option as string (util-linux < 2.26.2) as well as MS_LAZYTIME vfs flag (>= 2.26.2).

IMHO the function ext4_remount() does not check VFS *flags for MS_LAZYTIME at all. The code probably cares about sb->s_flags only (these flags are generated by parse_options() when parse options string). It seems that only MS_RDONLY is expected in *flags.

Ted?

Karel

Signature · 6 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw
Quoted 17 lines · Karel Zak
Quoted 16 lines · Holger Hoffstätte
Quoted 16 lines

playing with lazytime on 4.0.4-rc1 + yesterday's fencepost patch) I noticed something odd. Mounting secondary (non-root) partitions with lazytime works fine, but / does not seem to retain the value from fstab - apparently because it is remounted rw during boot, and lazytime gets swallowed/undone.

Same effect when trying to remount manually with lazytime:

tux>findmnt /
TARGET SOURCE FSTYPE OPTIONS
/ /dev/sda1 ext4 rw,noatime

tux>mount -o lazytime,remount /

tux>dmesg

[ 5208.482505] EXT4-fs (sda1): re-mounted. Opts: (null)
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

tux>findmnt /
TARGET SOURCE FSTYPE OPTIONS
/ /dev/sda1 ext4 rw,noatime

tux>mount --version
mount from util-linux 2.26.2 (libmount 2.26.0: assert, debug)

And what does /proc/mounts say? That'll tell you what is actually set on the superblock. Works here, on 4.1.0-rc2:

# mount /dev/sdb1 /mnt/test
# mount -o remount,lazytime /mnt/test
# grep sdb1 /proc/mounts 
/dev/sdb1 /mnt/test ext4 rw,lazytime,seclabel,relatime,data=ordered 0 0
# dmesg | tail -n 2
[516203.450943] EXT4-fs (sdb1): mounted filesystem with ordered data mode. Opts: (null)
[516211.222020] EXT4-fs (sdb1): re-mounted. Opts: lazytime

-Eric

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw
In reply to Karel Zak
Quoted 8 lines · Karel Zak

I see the problem on another place. The ext4 fs driver has unique feature that it's able to accept "lazytime" option as string (util-linux < 2.26.2) as well as MS_LAZYTIME vfs flag (>= 2.26.2).

IMHO the function ext4_remount() does not check VFS *flags for MS_LAZYTIME at all. The code probably cares about sb->s_flags only (these flags are generated by parse_options() when parse options string). It seems that only MS_RDONLY is expected in *flags.

Yep, the bug is on my side, in ext4_remount(). I'll get this fixed and marked as something that should get bacported to the stable tree. My apologies for the oversight.

- Ted

#5 lore raw
In reply to Eric Sandeen
Quoted 28 lines · Eric Sandeen
Quoted 17 lines · Karel Zak
Quoted 16 lines · Holger Hoffstätte
Quoted 16 lines

playing with lazytime on 4.0.4-rc1 + yesterday's fencepost patch) I noticed something odd. Mounting secondary (non-root) partitions with lazytime works fine, but / does not seem to retain the value from fstab - apparently because it is remounted rw during boot, and lazytime gets swallowed/undone.

Same effect when trying to remount manually with lazytime:

tux>findmnt /
TARGET SOURCE FSTYPE OPTIONS
/ /dev/sda1 ext4 rw,noatime

tux>mount -o lazytime,remount /

tux>dmesg

[ 5208.482505] EXT4-fs (sda1): re-mounted. Opts: (null)
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

tux>findmnt /
TARGET SOURCE FSTYPE OPTIONS
/ /dev/sda1 ext4 rw,noatime

tux>mount --version
mount from util-linux 2.26.2 (libmount 2.26.0: assert, debug)

And what does /proc/mounts say? That'll tell you what is actually set on the superblock. Works here, on 4.1.0-rc2:

Quoted 8 lines
# mount /dev/sdb1 /mnt/test
# mount -o remount,lazytime /mnt/test
# grep sdb1 /proc/mounts 
/dev/sdb1 /mnt/test ext4 rw,lazytime,seclabel,relatime,data=ordered 0 0
# dmesg | tail -n 2
[516203.450943] EXT4-fs (sdb1): mounted filesystem with ordered data mode. Opts: (null)
[516211.222020] EXT4-fs (sdb1): re-mounted. Opts: lazytime

When I used util-linux 2.26.2 /proc/mounts never contained lazytime for the root device (sda1), despite the fact that it and other partitions explicitly had lazytime in fstab. Secondary drives & partitions *did* get the value right from the start, i.e. anything that didn't go through a ro->remount transition.

It all works reliably with 2.25.x since - as Karel mentioned - the bug seems with ext4's remount logic in combination with readonly (as was the case with the root partition) and mount now actually sending the MS_LAZYTIME flag, instead of relying on ext4's builtin extra handling.

-h

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw
In reply to Theodore Ts'o
Quoted 5 lines · Theodore Ts'o
Quoted 4 lines · Karel Zak

I see the problem on another place. The ext4 fs driver has unique feature that it's able to accept "lazytime" option as string (util-linux < 2.26.2) as well as MS_LAZYTIME vfs flag (>= 2.26.2).

Quoted 8 lines
Quoted 4 lines

IMHO the function ext4_remount() does not check VFS *flags for MS_LAZYTIME at all. The code probably cares about sb->s_flags only (these flags are generated by parse_options() when parse options string). It seems that only MS_RDONLY is expected in *flags.

Yep, the bug is on my side, in ext4_remount(). I'll get this fixed and marked as something that should get bacported to the stable tree. My apologies for the oversight.

Thanks for confirming, Ted! I'll gladly test a patch for 4.0.x.

-h