]> git.baikalelectronics.ru Git - kernel.git/commitdiff
xfs: preserve inode versioning across remounts
authorEric Sandeen <sandeen@redhat.com>
Fri, 11 Nov 2022 04:10:24 +0000 (09:40 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 Nov 2022 16:42:03 +0000 (17:42 +0100)
commit 78a94d3d57646d0b1ccfb4d5de764e73d0d9d63e upstream.

[ For 5.4.y, SB_I_VERSION should be set in xfs_fs_remount() ]

The MS_I_VERSION mount flag is exposed via the VFS, as documented
in the mount manpages etc; see the iversion and noiversion mount
options in mount(8).

As a result, mount -o remount looks for this option in /proc/mounts
and will only send the I_VERSION flag back in during remount it it
is present.  Since it's not there, a remount will /remove/ the
I_VERSION flag at the vfs level, and iversion functionality is lost.

xfs v5 superblocks intend to always have i_version enabled; it is
set as a default at mount time, but is lost during remount for the
reasons above.

The generic fix would be to expose this documented option in
/proc/mounts, but since that was rejected, fix it up again in the
xfs remount path instead, so that at least xfs won't suffer from
this misbehavior.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Acked-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/xfs/xfs_super.c

index 2429acbfb13247fd3a7fa3d0f71c3bf6fe426e87..f1407900aeef90f0dc0f2d76c4f45515375d693d 100644 (file)
@@ -1228,6 +1228,10 @@ xfs_fs_remount(
        char                    *p;
        int                     error;
 
+       /* version 5 superblocks always support version counters. */
+       if (XFS_SB_VERSION_NUM(&mp->m_sb) == XFS_SB_VERSION_5)
+               *flags |= SB_I_VERSION;
+
        /* First, check for complete junk; i.e. invalid options */
        error = xfs_test_remount_options(sb, options);
        if (error)