aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/ioctl.c')
-rw-r--r--fs/btrfs/ioctl.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index a506a22b522a..edd82becbb9e 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1898,7 +1898,10 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
1898 1898
1899 memcpy(&new_key, &key, sizeof(new_key)); 1899 memcpy(&new_key, &key, sizeof(new_key));
1900 new_key.objectid = inode->i_ino; 1900 new_key.objectid = inode->i_ino;
1901 new_key.offset = key.offset + destoff - off; 1901 if (off <= key.offset)
1902 new_key.offset = key.offset + destoff - off;
1903 else
1904 new_key.offset = destoff;
1902 1905
1903 trans = btrfs_start_transaction(root, 1); 1906 trans = btrfs_start_transaction(root, 1);
1904 if (IS_ERR(trans)) { 1907 if (IS_ERR(trans)) {