Skip to content

Commit 7885ca4

Browse files
maharmstonekdave
authored andcommitted
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. Reported-by: Chris Mason <clm@fb.com> Link: https://lore.kernel.org/linux-btrfs/20260125125129.2245240-1-clm@meta.com/ Fixes: 979e1dc ("btrfs: handle deletions from remapped block group") Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Mark Harmstone <mark@harmstone.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 54b9395 commit 7885ca4

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

fs/btrfs/relocation.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4723,6 +4723,7 @@ int btrfs_last_identity_remap_gone(struct btrfs_chunk_map *chunk_map,
47234723
ret = btrfs_remove_dev_extents(trans, chunk_map);
47244724
if (unlikely(ret)) {
47254725
btrfs_abort_transaction(trans, ret);
4726+
btrfs_end_transaction(trans);
47264727
return ret;
47274728
}
47284729

@@ -4732,6 +4733,7 @@ int btrfs_last_identity_remap_gone(struct btrfs_chunk_map *chunk_map,
47324733
if (unlikely(ret)) {
47334734
mutex_unlock(&trans->fs_info->chunk_mutex);
47344735
btrfs_abort_transaction(trans, ret);
4736+
btrfs_end_transaction(trans);
47354737
return ret;
47364738
}
47374739
}
@@ -4750,6 +4752,7 @@ int btrfs_last_identity_remap_gone(struct btrfs_chunk_map *chunk_map,
47504752
ret = remove_chunk_stripes(trans, chunk_map, path);
47514753
if (unlikely(ret)) {
47524754
btrfs_abort_transaction(trans, ret);
4755+
btrfs_end_transaction(trans);
47534756
return ret;
47544757
}
47554758

0 commit comments

Comments
 (0)