diff options
author | Filipe Manana <fdmanana@suse.com> | 2025-06-07 19:44:03 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2025-07-21 23:57:56 +0200 |
commit | 1f06c942aa709d397cf6bed577a0d10a61509667 (patch) | |
tree | 29b18088fbc0f3761a6be13ff8eaf0aa5022e7c7 /fs/btrfs/tree-log.c | |
parent | 936f0b49dc4ac29a34a1501342a489d4fe366b9b (diff) |
btrfs: always abort transaction on failure to add block group to free space tree
Only one of the callers of __add_block_group_free_space() aborts the
transaction if the call fails, while the others don't do it and it's
either never done up the call chain or much higher in the call chain.
So make sure we abort the transaction at __add_block_group_free_space()
if it fails, which brings a couple benefits:
1) If some call chain never aborts the transaction, we avoid having some
metadata inconsistency because BLOCK_GROUP_FLAG_NEEDS_FREE_SPACE is
cleared when we enter __add_block_group_free_space() and therefore
__add_block_group_free_space() is never called again to add the block
group items to the free space tree, since the function is only called
when that flag is set in a block group;
2) If the call chain already aborts the transaction, then we get a better
trace that points to the exact step from __add_block_group_free_space()
which failed, which is better for analysis.
So abort the transaction at __add_block_group_free_space() if any of its
steps fails.
CC: stable@vger.kernel.org # 6.6+
Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/tree-log.c')
0 files changed, 0 insertions, 0 deletions