]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
xfs: fix xfs_reflink_unshare usage of filemap_write_and_wait_range
authorDarrick J. Wong <djwong@kernel.org>
Sun, 3 Jul 2022 05:04:56 +0000 (08:04 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 7 Jul 2022 15:52:20 +0000 (17:52 +0200)
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@kernel.org>
Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
Reviewed-by: Brian Foster <bfoster@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_reflink.c

index 6fa05fb78189bb1b2479d5071f690ed00e22f8d2..aa46b75d75af5a517a6b23180c8b4a95b9d86fcb 100644 (file)
@@ -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;