Skip to content

Commit 207910d

Browse files
Mark Fashehmasoncl
authored andcommitted
btrfs: pass unaligned length to btrfs_cmp_data()
In the case that we dedupe the tail of a file, we might expand the dedupe len out to the end of our last block. We don't want to compare data past i_size however, so pass the original length to btrfs_cmp_data(). Signed-off-by: Mark Fasheh <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: Chris Mason <[email protected]>
1 parent a89ca6f commit 207910d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/btrfs/ioctl.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2943,7 +2943,8 @@ static int btrfs_extent_same(struct inode *src, u64 loff, u64 olen,
29432943
goto out_unlock;
29442944
}
29452945

2946-
ret = btrfs_cmp_data(src, loff, dst, dst_loff, len);
2946+
/* pass original length for comparison so we stay within i_size */
2947+
ret = btrfs_cmp_data(src, loff, dst, dst_loff, olen);
29472948
if (ret == 0)
29482949
ret = btrfs_clone(src, dst, loff, olen, len, dst_loff);
29492950

0 commit comments

Comments
 (0)