This is a note to let you know that I've just added the patch titled xfs: only bother with sync_filesystem during readonly remount to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: xfs-only-bother-with-sync_filesystem-during-readonly-remount.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Thu Jun 30 01:21:44 PM CEST 2022 From: Leah Rumancik <leah.rumancik@xxxxxxxxx> Date: Tue, 28 Jun 2022 11:39:51 -0700 Subject: xfs: only bother with sync_filesystem during readonly remount To: stable@xxxxxxxxxxxxxxx Cc: linux-xfs@xxxxxxxxxxxxxxx, amir73il@xxxxxxxxx, "Darrick J. Wong" <djwong@xxxxxxxxxx>, Dave Chinner <dchinner@xxxxxxxxxx>, Leah Rumancik <leah.rumancik@xxxxxxxxx> Message-ID: <20220628183951.3425528-8-leah.rumancik@xxxxxxxxx> From: "Darrick J. Wong" <djwong@xxxxxxxxxx> [ Upstream commit b97cca3ba9098522e5a1c3388764ead42640c1a5 ] 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@xxxxxxxxxx> Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx> Signed-off-by: Leah Rumancik <leah.rumancik@xxxxxxxxx> Acked-by: Darrick J. Wong <djwong@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/xfs/xfs_super.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -1773,6 +1773,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. @@ -1851,8 +1856,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; Patches currently in stable-queue which might be from leah.rumancik@xxxxxxxxx are queue-5.15/xfs-only-bother-with-sync_filesystem-during-readonly-remount.patch queue-5.15/xfs-prevent-uaf-in-xfs_log_item_in_current_chkpt.patch queue-5.15/xfs-fix-the-free-logic-of-state-in-xfs_attr_node_hasname.patch queue-5.15/xfs-punch-out-data-fork-delalloc-blocks-on-cow-writeback-failure.patch queue-5.15/xfs-use-kmem_cache_free-for-kmem_cache-objects.patch queue-5.15/xfs-remove-all-cow-fork-extents-when-remounting-readonly.patch queue-5.15/xfs-check-sb_meta_uuid-for-dabuf-buffer-recovery.patch