This is a note to let you know that I've just added the patch titled xfs: fix xfs_reflink_unshare usage of filemap_write_and_wait_range to the 5.10-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-fix-xfs_reflink_unshare-usage-of-filemap_write_and_wait_range.patch and it can be found in the queue-5.10 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 Mon Jul 4 04:42:02 PM CEST 2022 From: Amir Goldstein <amir73il@xxxxxxxxx> Date: Sun, 3 Jul 2022 08:04:56 +0300 Subject: xfs: fix xfs_reflink_unshare usage of filemap_write_and_wait_range To: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Cc: Sasha Levin <sashal@xxxxxxxxxx>, "Darrick J . Wong" <djwong@xxxxxxxxxx>, Leah Rumancik <leah.rumancik@xxxxxxxxx>, Chandan Babu R <chandan.babu@xxxxxxxxxx>, Luis Chamberlain <mcgrof@xxxxxxxxxx>, Adam Manzanares <a.manzanares@xxxxxxxxxxx>, linux-xfs@xxxxxxxxxxxxxxx, stable@xxxxxxxxxxxxxxx, Chandan Babu R <chandanrlinux@xxxxxxxxx>, Brian Foster <bfoster@xxxxxxxxxx> Message-ID: <20220703050456.3222610-8-amir73il@xxxxxxxxx> From: "Darrick J. Wong" <djwong@xxxxxxxxxx> commit d4f74e162d238ce00a640af5f0611c3f51dad70e upstream. The final parameter of filemap_write_and_wait_range is the end of the range to flush, not the length of the range to flush. Fixes: 46afb0628b86 ("xfs: only flush the unshared range in xfs_reflink_unshare") Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> Reviewed-by: Chandan Babu R <chandanrlinux@xxxxxxxxx> Reviewed-by: Brian Foster <bfoster@xxxxxxxxxx> Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx> Acked-by: Darrick J. Wong <djwong@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/xfs/xfs_reflink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/xfs/xfs_reflink.c +++ b/fs/xfs/xfs_reflink.c @@ -1503,7 +1503,8 @@ xfs_reflink_unshare( if (error) goto out; - error = filemap_write_and_wait_range(inode->i_mapping, offset, len); + error = filemap_write_and_wait_range(inode->i_mapping, offset, + offset + len - 1); if (error) goto out; Patches currently in stable-queue which might be from amir73il@xxxxxxxxx are queue-5.10/xfs-rename-variable-mp-to-parsing_mp.patch queue-5.10/xfs-fix-xfs_trans-slab-cache-name.patch queue-5.10/xfs-skip-repetitive-warnings-about-mount-options.patch queue-5.10/xfs-use-current-journal_info-for-detecting-transaction-recursion.patch queue-5.10/xfs-update-superblock-counters-correctly-for-lazysbcount.patch queue-5.10/xfs-ensure-xfs_errortag_random_default-matches-xfs_errtag_max.patch queue-5.10/xfs-fix-xfs_reflink_unshare-usage-of-filemap_write_and_wait_range.patch