Skip to content

Commit b6f3409

Browse files
liewegaschrismason-xx
authored andcommitted
Btrfs: reserve sufficient space for ioctl clone
Fix a crash/BUG_ON in the clone ioctl due to insufficient reservation. We need to reserve space for: - adjusting the old extent (possibly splitting it) - adding the new extent - updating the inode Signed-off-by: Sage Weil <[email protected]> Signed-off-by: Chris Mason <[email protected]>
1 parent dde820f commit b6f3409

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

fs/btrfs/ioctl.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2336,7 +2336,12 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
23362336
else
23372337
new_key.offset = destoff;
23382338

2339-
trans = btrfs_start_transaction(root, 1);
2339+
/*
2340+
* 1 - adjusting old extent (we may have to split it)
2341+
* 1 - add new extent
2342+
* 1 - inode update
2343+
*/
2344+
trans = btrfs_start_transaction(root, 3);
23402345
if (IS_ERR(trans)) {
23412346
ret = PTR_ERR(trans);
23422347
goto out;

0 commit comments

Comments
 (0)