Skip to content

Commit 282d1aa

Browse files
Haisu Wanggregkh
authored andcommitted
btrfs: fix the length of reserved qgroup to free
commit 2b084d8205949dd804e279df8e68531da78be1e8 upstream. The dealloc flag may be cleared and the extent won't reach the disk in cow_file_range when errors path. The reserved qgroup space is freed in commit 30479f31d44d ("btrfs: fix qgroup reserve leaks in cow_file_range"). However, the length of untouched region to free needs to be adjusted with the correct remaining region size. Fixes: 30479f31d44d ("btrfs: fix qgroup reserve leaks in cow_file_range") CC: [email protected] # 6.11+ Reviewed-by: Qu Wenruo <[email protected]> Reviewed-by: Boris Burkov <[email protected]> Signed-off-by: Haisu Wang <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 7d8bb97 commit 282d1aa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1442,7 +1442,7 @@ static noinline int cow_file_range(struct btrfs_inode *inode,
14421442
clear_bits |= EXTENT_CLEAR_DATA_RESV;
14431443
extent_clear_unlock_delalloc(inode, start, end, locked_page,
14441444
clear_bits, page_ops);
1445-
btrfs_qgroup_free_data(inode, NULL, start, cur_alloc_size, NULL);
1445+
btrfs_qgroup_free_data(inode, NULL, start, end - start + 1, NULL);
14461446
}
14471447
return ret;
14481448
}

0 commit comments

Comments
 (0)