btrfs: fix transaction handle leaks in btrfs_last_identity_remap_gone()
PATCH 1/1 btrfs: fix transaction handle leaks in btrfs_last_identity_remap_gone()
btrfs_abort_transaction(), unlike btrfs_commit_transaction(), doesn't also free the transaction handle. Fix the instances in btrfs_last_identity_remap_gone() where we're also leaking the transaction on abort.
This fixes a bug introduced in "btrfs: handle deletions from remapped block group" in for-next.
--- fs/btrfs/relocation.c | 3 +++ 1 file changed, 3 insertions(+)
fs/btrfs/relocation.c +3 -0
@@ -4715,6 +4715,7 @@ int btrfs_last_identity_remap_gone(struct btrfs_chunk_map *chunk_map, ret =btrfs_remove_dev_extents (trans, chunk_map);if (unlikely (ret)) {btrfs_abort_transaction (trans, ret); +btrfs_end_transaction (trans);return ret; }
@@ -4724,6 +4725,7 @@ int btrfs_last_identity_remap_gone(struct btrfs_chunk_map *chunk_map,if (unlikely (ret)) {mutex_unlock (&trans->fs_info->chunk_mutex);btrfs_abort_transaction (trans, ret); +btrfs_end_transaction (trans);return ret; } }
@@ -4742,6 +4744,7 @@ int btrfs_last_identity_remap_gone(struct btrfs_chunk_map *chunk_map, ret =remove_chunk_stripes (trans, chunk_map, path);if (unlikely (ret)) {btrfs_abort_transaction (trans, ret); +btrfs_end_transaction (trans);return ret; }
Signature · 1 line
2.52.0
Quoted 8 lines · Mark Harmstone
btrfs_abort_transaction(), unlikebtrfs_commit_transaction(), doesn't also free the transaction handle. Fix the instances inbtrfs_last_identity_remap_gone()where we're also leaking the transaction on abort.This fixes a bug introduced in "btrfs: handle deletions from remapped block group" in for-next.
In for-next and in Linus' tree already, commit 979e1dc3d69e4c825eec05d05d9567b251f6ec23.
Once you see David's pull request to Linus, you can assume the commit ID is stable and it will match the commit ID in Linus' tree once merged.
So we can, and should, add here:
With that added:
Thanks.
Quoted 40 lines
Signed-off-by Mark Harmstone <[email protected]>Suggested-by Chris Mason <[email protected]>--- fs/btrfs/relocation.c | 3 +++ 1 file changed, 3 insertions(+)fs/btrfs/relocation.c +3
-1@@ -4715,6 +4715,7 @@ int btrfs_last_identity_remap_gone(struct btrfs_chunk_map *chunk_map, ret =btrfs_remove_dev_extents (trans, chunk_map);if (unlikely (ret)) {btrfs_abort_transaction (trans, ret); +btrfs_end_transaction (trans);return ret; }@@ -4724,6 +4725,7 @@ int btrfs_last_identity_remap_gone(struct btrfs_chunk_map *chunk_map,if (unlikely (ret)) {mutex_unlock (&trans->fs_info->chunk_mutex);btrfs_abort_transaction (trans, ret); +btrfs_end_transaction (trans);return ret; } }@@ -4742,6 +4744,7 @@ int btrfs_last_identity_remap_gone(struct btrfs_chunk_map *chunk_map, ret =remove_chunk_stripes (trans, chunk_map, path);if (unlikely (ret)) {btrfs_abort_transaction (trans, ret); +btrfs_end_transaction (trans);return ret; } --2.52.0