• Lukas Czerner's avatar
    ext4: handle option set by mount flags correctly · f25391eb
    Lukas Czerner authored
    Currently there is a problem with mount options that can be both set by
    vfs using mount flags or by a string parsing in ext4.
    
    i_version/iversion options gets lost after remount, for example
    
    $ mount -o i_version /dev/pmem0 /mnt
    $ grep pmem0 /proc/self/mountinfo | grep i_version
    310 95 259:0 / /mnt rw,relatime shared:163 - ext4 /dev/pmem0 rw,seclabel,i_version
    $ mount -o remount,ro /mnt
    $ grep pmem0 /proc/self/mountinfo | grep i_version
    
    nolazytime gets ignored by ext4 on remount, for example
    
    $ mount -o lazytime /dev/pmem0 /mnt
    $ grep pmem0 /proc/self/mountinfo | grep lazytime
    310 95 259:0 / /mnt rw,relatime shared:163 - ext4 /dev/pmem0 rw,lazytime,seclabel
    $ mount -o remount,nolazytime /mnt
    $ grep pmem0 /proc/self/mountinfo | grep lazytime
    310 95 259:0 / /mnt rw,relatime shared:163 - ext4 /dev/pmem0 rw,lazytime,seclabel
    
    Fix it by applying the SB_LAZYTIME and SB_I_VERSION flags from *flags to
    s_flags before we parse the option and use the resulting state of the
    same flags in *flags at the end of successful remount.
    Signed-off-by: default avatarLukas Czerner <lczerner@redhat.com>
    Reviewed-by: default avatarRitesh Harjani <riteshh@linux.ibm.com>
    Link: https://lore.kernel.org/r/20200723150526.19931-1-lczerner@redhat.comSigned-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
    f25391eb
super.c 182 KB