]> www.infradead.org Git - users/jedix/linux-maple.git/commit
btrfs: fix missing error handling when adding delayed ref with qgroups enabled
authorFilipe Manana <fdmanana@suse.com>
Tue, 24 Sep 2024 13:39:19 +0000 (14:39 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 7 Oct 2024 21:22:30 +0000 (23:22 +0200)
commit6ef8fbce010421bf742b12b8f8f2b2d2ff154845
tree251d721903f78c5f176ed67597ace74c26060179
parent69313850dce33ce8c24b38576a279421f4c60996
btrfs: fix missing error handling when adding delayed ref with qgroups enabled

When adding a delayed ref head, at delayed-ref.c:add_delayed_ref_head(),
if we fail to insert the qgroup record we don't error out, we ignore it.
In fact we treat it as if there was no error and there was already an
existing record - we don't distinguish between the cases where
btrfs_qgroup_trace_extent_nolock() returns 1, meaning a record already
existed and we can free the given record, and the case where it returns
a negative error value, meaning the insertion into the xarray that is
used to track records failed.

Effectively we end up ignoring that we are lacking qgroup record in the
dirty extents xarray, resulting in incorrect qgroup accounting.

Fix this by checking for errors and return them to the callers.

Fixes: 3cce39a8ca4e ("btrfs: qgroup: use xarray to track dirty extents in transaction")
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/delayed-ref.c