Btrfs: fix clone ioctl where range is adjacent to extent
authorSage Weil <sage@newdream.net>
Fri, 29 Oct 2010 19:37:33 +0000 (15:37 -0400)
committerChris Mason <chris.mason@oracle.com>
Fri, 29 Oct 2010 19:37:33 +0000 (15:37 -0400)
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 <yehuda@hq.newdream.net>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/ioctl.c

index d94bef5..3fe15e4 100644 (file)
@@ -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;