]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
xfs: only bother with sync_filesystem during readonly remount
authorDarrick J. Wong <djwong@kernel.org>
Tue, 23 Aug 2022 12:11:36 +0000 (15:11 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 31 Aug 2022 15:15:14 +0000 (17:15 +0200)
commit b97cca3ba9098522e5a1c3388764ead42640c1a5 upstream.

In commit 02b9984d6408, we pushed a sync_filesystem() call from the VFS
into xfs_fs_remount.  The only time that we ever need to push dirty file
data or metadata to disk for a remount is if we're remounting the
filesystem read only, so this really could be moved to xfs_remount_ro.

Once we've moved the call site, actually check the return value from
sync_filesystem.

Fixes: 02b9984d6408 ("fs: push sync_filesystem() down to the file system's remount_fs()")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Acked-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/xfs/xfs_super.c

index ff686cb16c7b9840d2326f5a56373750d12362af..434c87cc9fbf552d7e68c07e8a0031190e3c84b8 100644 (file)
@@ -1720,6 +1720,11 @@ xfs_remount_ro(
        };
        int                     error;
 
+       /* Flush all the dirty data to disk. */
+       error = sync_filesystem(mp->m_super);
+       if (error)
+               return error;
+
        /*
         * Cancel background eofb scanning so it cannot race with the final
         * log force+buftarg wait and deadlock the remount.
@@ -1790,8 +1795,6 @@ xfs_fc_reconfigure(
        if (error)
                return error;
 
-       sync_filesystem(mp->m_super);
-
        /* inode32 -> inode64 */
        if ((mp->m_flags & XFS_MOUNT_SMALL_INUMS) &&
            !(new_mp->m_flags & XFS_MOUNT_SMALL_INUMS)) {