Skip to content

Commit 2b084d8

Browse files
Haisu Wangkdave
authored andcommitted
btrfs: fix the length of reserved qgroup to free
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 30479f3 ("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: 30479f3 ("btrfs: fix qgroup reserve leaks in cow_file_range") CC: stable@vger.kernel.org # 6.11+ Reviewed-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Boris Burkov <boris@bur.io> Signed-off-by: Haisu Wang <haisuwang@tencent.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent c9a75ec commit 2b084d8

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
@@ -1618,7 +1618,7 @@ static noinline int cow_file_range(struct btrfs_inode *inode,
16181618
clear_bits |= EXTENT_CLEAR_DATA_RESV;
16191619
extent_clear_unlock_delalloc(inode, start, end, locked_folio,
16201620
&cached, clear_bits, page_ops);
1621-
btrfs_qgroup_free_data(inode, NULL, start, cur_alloc_size, NULL);
1621+
btrfs_qgroup_free_data(inode, NULL, start, end - start + 1, NULL);
16221622
}
16231623
return ret;
16241624
}

0 commit comments

Comments
 (0)