diff options
Diffstat (limited to 'fs/btrfs/ioctl.c')
-rw-r--r-- | fs/btrfs/ioctl.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index f87552a1d7ea..1b61dab64062 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -1788,7 +1788,10 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, | |||
1788 | 1788 | ||
1789 | memcpy(&new_key, &key, sizeof(new_key)); | 1789 | memcpy(&new_key, &key, sizeof(new_key)); |
1790 | new_key.objectid = inode->i_ino; | 1790 | new_key.objectid = inode->i_ino; |
1791 | new_key.offset = key.offset + destoff - off; | 1791 | if (off <= key.offset) |
1792 | new_key.offset = key.offset + destoff - off; | ||
1793 | else | ||
1794 | new_key.offset = destoff; | ||
1792 | 1795 | ||
1793 | trans = btrfs_start_transaction(root, 1); | 1796 | trans = btrfs_start_transaction(root, 1); |
1794 | if (IS_ERR(trans)) { | 1797 | if (IS_ERR(trans)) { |