diff options
author | Haisu Wang <haisuwang@tencent.com> | 2024-10-25 14:54:40 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2024-11-07 02:08:29 +0100 |
commit | 2b084d8205949dd804e279df8e68531da78be1e8 (patch) | |
tree | 9ac5c85b966de2cbfe0aa73599f2f9f6bbd2b0f9 /fs | |
parent | c9a75ec45f1111ef530ab186c2a7684d0a0c9245 (diff) | |
download | linux-stable-2b084d8205949dd804e279df8e68531da78be1e8.tar.gz linux-stable-2b084d8205949dd804e279df8e68531da78be1e8.tar.bz2 linux-stable-2b084d8205949dd804e279df8e68531da78be1e8.zip |
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 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: 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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/inode.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index c6d257fb40af..a97dfc72a80a 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1618,7 +1618,7 @@ out_unlock: clear_bits |= EXTENT_CLEAR_DATA_RESV; extent_clear_unlock_delalloc(inode, start, end, locked_folio, &cached, clear_bits, page_ops); - btrfs_qgroup_free_data(inode, NULL, start, cur_alloc_size, NULL); + btrfs_qgroup_free_data(inode, NULL, start, end - start + 1, NULL); } return ret; } |