Skip to contentSkip to conversation

xfs: only bother with sync_filesystem during readonly remount

PATCH In review Darrick J. Wong 2 participants 2 messages Feb 8, 2022 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: only bother with sync_filesystem during readonly remount

From: Darrick J. Wong <[email protected]>

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()")
---
 fs/xfs/xfs_super.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
fs/xfs/xfs_super.c +5 -2
index 4c0dee78b2f8..d84714e4e46a 100644
@@ -1753,6 +1753,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.
@@ -1831,8 +1836,6 @@ xfs_fs_reconfigure(
 	if (error)
 		return error;
 
-	sync_filesystem(mp->m_super);
-
 	/* inode32 -> inode64 */
 	if (xfs_has_small_inums(mp) && !xfs_has_small_inums(new_mp)) {
 		mp->m_features &= ~XFS_FEAT_SMALL_INUMS;
Reviewed-by on v1 1/1
#1 lore raw
Quoted 33 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

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()")
---
 fs/xfs/xfs_super.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
fs/xfs/xfs_super.c +5 -0
index 4c0dee78b2f8..d84714e4e46a 100644
@@ -1753,6 +1753,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.

fs/xfs/xfs_super.c xfs_fs_reconfigure( · line 1841

Quoted 8 lines
fs/xfs/xfs_super.c +0 -2
@@ -1831,8 +1836,6 @@ xfs_fs_reconfigure(
 	if (error)
 		return error;
 
-	sync_filesystem(mp->m_super);
-
 	/* inode32 -> inode64 */
 	if (xfs_has_small_inums(mp) && !xfs_has_small_inums(new_mp)) {
 		mp->m_features &= ~XFS_FEAT_SMALL_INUMS;

Looks ok.

Signature · 2 lines
Dave Chinner
[email protected]