mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 02:19:51 +00:00
Btrfs: fix transaction handle leak in balance
If we fail to allocate a new data chunk, we were jumping to the error path
without release the transaction handle we got before. Fix this by always
releasing it before doing the jump.
Fixes: 2c9fe83552
("btrfs: Fix lost-data-profile caused by balance bg")
Signed-off-by: Filipe Manana <fdmanana@suse.com>
This commit is contained in:
parent
348a0013d5
commit
8a7d656f3d
1 changed files with 1 additions and 2 deletions
|
@ -3548,12 +3548,11 @@ static int __btrfs_balance(struct btrfs_fs_info *fs_info)
|
||||||
|
|
||||||
ret = btrfs_force_chunk_alloc(trans, chunk_root,
|
ret = btrfs_force_chunk_alloc(trans, chunk_root,
|
||||||
BTRFS_BLOCK_GROUP_DATA);
|
BTRFS_BLOCK_GROUP_DATA);
|
||||||
|
btrfs_end_transaction(trans, chunk_root);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
mutex_unlock(&fs_info->delete_unused_bgs_mutex);
|
mutex_unlock(&fs_info->delete_unused_bgs_mutex);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
btrfs_end_transaction(trans, chunk_root);
|
|
||||||
chunk_reserved = 1;
|
chunk_reserved = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue