aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2017-01-09 10:38:41 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-01-12 05:39:40 -0500
commit3903257660338c41c22a2464407c8ff93c42e00b (patch)
tree03841d84a84502c86edc33d21c96d0d41f0d1621 /fs
parent2b7dae91a1341302077798ddc38e8bfd8a012cf1 (diff)
xfs: always succeed when deduping zero bytes
commit fba3e594ef0ad911fa8f559732d588172f212d71 upstream. It turns out that btrfs and xfs had differing interpretations of what to do when the dedupe length is zero. Change xfs to follow btrfs' semantics so that the userland interface is consistent. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/xfs_reflink.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index 0edf835af32d..4d99100a4bbf 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -1345,8 +1345,14 @@ xfs_reflink_remap_range(
1345 goto out_unlock; 1345 goto out_unlock;
1346 } 1346 }
1347 1347
1348 if (len == 0) 1348 /* Zero length dedupe exits immediately; reflink goes to EOF. */
1349 if (len == 0) {
1350 if (is_dedupe) {
1351 ret = 0;
1352 goto out_unlock;
1353 }
1349 len = isize - pos_in; 1354 len = isize - pos_in;
1355 }
1350 1356
1351 /* Ensure offsets don't wrap and the input is inside i_size */ 1357 /* Ensure offsets don't wrap and the input is inside i_size */
1352 if (pos_in + len < pos_in || pos_out + len < pos_out || 1358 if (pos_in + len < pos_in || pos_out + len < pos_out ||