btrfs: move transaction aborts to the error site in add_block_group_free_space()
David Sterba
maintainerPATCH 1/1 btrfs: move transaction aborts to the error site in add_block_group_free_space()
Transaction aborts should be done next to the place the error happens, which was not done in add_block_group_free_space().
Signed-off-by David Sterba <[email protected]>
--- fs/btrfs/free-space-tree.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/btrfs/free-space-tree.c +3 -2
@@ -1408,16 +1408,17 @@ int add_block_group_free_space(struct btrfs_trans_handle *trans, path =btrfs_alloc_path ();if (!path) { ret = -ENOMEM ; +btrfs_abort_transaction (trans, ret); goto out; } ret =__add_block_group_free_space (trans, block_group, path); +if (ret) +btrfs_abort_transaction (trans, ret); out:btrfs_free_path (path);mutex_unlock (&block_group->free_space_lock); -if (ret) -btrfs_abort_transaction (trans, ret);return ret; }
Signature · 1 line
2.49.0
Quoted 5 lines · David Sterba
Transaction aborts should be done next to the place the error happens, which was not done in
add_block_group_free_space().Signed-off-by David Sterba <[email protected]>
Reviewed-by Filipe Manana <[email protected]>
Looks good, thanks.
Quoted 32 lines
--- fs/btrfs/free-space-tree.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)fs/btrfs/free-space-tree.c +3
-3@@ -1408,16 +1408,17 @@ int add_block_group_free_space(struct btrfs_trans_handle *trans, path =btrfs_alloc_path ();if (!path) { ret = -ENOMEM ; +btrfs_abort_transaction (trans, ret); goto out; } ret =__add_block_group_free_space (trans, block_group, path); +if (ret) +btrfs_abort_transaction (trans, ret); out:btrfs_free_path (path);mutex_unlock (&block_group->free_space_lock); -if (ret) -btrfs_abort_transaction (trans, ret);return ret; } --2.49.0