summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2025-04-30 19:45:20 +0300
committerDavid Sterba <dsterba@suse.com>2025-05-15 15:30:54 +0300
commit11f25fad92ade05c5f84907222ea3f88afdc1767 (patch)
tree3c26259002d0381fc7dbb3e1cbbc15994bc5f064
parentaddaa67e3328403c272593c6776bbe90425f01d7 (diff)
downloadlinux-11f25fad92ade05c5f84907222ea3f88afdc1767.tar.xz
btrfs: move transaction aborts to the error site in remove_from_free_space_tree()
Transaction aborts should be done next to the place the error happens, which was not done in remove_from_free_space_tree(). Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--fs/btrfs/free-space-tree.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/btrfs/free-space-tree.c b/fs/btrfs/free-space-tree.c
index ef39d1034435..ffe98bea6927 100644
--- a/fs/btrfs/free-space-tree.c
+++ b/fs/btrfs/free-space-tree.c
@@ -850,6 +850,7 @@ int remove_from_free_space_tree(struct btrfs_trans_handle *trans,
path = btrfs_alloc_path();
if (!path) {
ret = -ENOMEM;
+ btrfs_abort_transaction(trans, ret);
goto out;
}
@@ -857,6 +858,7 @@ int remove_from_free_space_tree(struct btrfs_trans_handle *trans,
if (!block_group) {
DEBUG_WARN("no block group found for start=%llu", start);
ret = -ENOENT;
+ btrfs_abort_transaction(trans, ret);
goto out;
}
@@ -864,12 +866,12 @@ int remove_from_free_space_tree(struct btrfs_trans_handle *trans,
ret = __remove_from_free_space_tree(trans, block_group, path, start,
size);
mutex_unlock(&block_group->free_space_lock);
+ if (ret)
+ btrfs_abort_transaction(trans, ret);
btrfs_put_block_group(block_group);
out:
btrfs_free_path(path);
- if (ret)
- btrfs_abort_transaction(trans, ret);
return ret;
}