xfs: preserve inode versioning across remounts
authorEric Sandeen <sandeen@redhat.com>
Wed, 15 Jul 2020 15:30:37 +0000 (08:30 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Fri, 17 Jul 2020 20:20:20 +0000 (13:20 -0700)
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>
fs/xfs/xfs_super.c

index 5ef5d8416f7064ee7f609fc4cfcb6c8a677f498c..71ac6c1cdc36255d72054abcc5714add09a80b8e 100644 (file)
@@ -1721,6 +1721,10 @@ xfs_fc_reconfigure(
        int                     flags = fc->sb_flags;
        int                     error;
 
+       /* version 5 superblocks always support version counters. */
+       if (XFS_SB_VERSION_NUM(&mp->m_sb) == XFS_SB_VERSION_5)
+               fc->sb_flags |= SB_I_VERSION;
+
        error = xfs_fc_validate_params(new_mp);
        if (error)
                return error;