From: Sage Weil Date: Fri, 29 Oct 2010 19:37:33 +0000 (-0400) Subject: Btrfs: fix clone ioctl where range is adjacent to extent X-Git-Tag: upstream/snapshot3+hdmi~11282^2~105 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=050006a753bab8ba05f2113cc57ba49398cd5521;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git Btrfs: fix clone ioctl where range is adjacent to extent We had an edge case issue where the requested range was just following an existing extent. Instead of skipping to the next extent, we used the previous one which lead to having zero sized extents. Signed-off-by: Yehuda Sadeh Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index d94bef5..3fe15e4 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -1597,7 +1597,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, } btrfs_release_path(root, path); - if (key.offset + datal < off || + if (key.offset + datal <= off || key.offset >= off+len) goto next;