Skip to content

Commit

Permalink
Btrfs: fix transaction handle leak in balance
Browse files Browse the repository at this point in the history
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: 2c9fe83 ("btrfs: Fix lost-data-profile caused by balance bg")
Signed-off-by: Filipe Manana <fdmanana@suse.com>
  • Loading branch information
Filipe Manana committed Dec 10, 2015
1 parent 348a001 commit 8a7d656
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions fs/btrfs/volumes.c
Original file line number Diff line number Diff line change
Expand Up @@ -3548,12 +3548,11 @@ static int __btrfs_balance(struct btrfs_fs_info *fs_info)

ret = btrfs_force_chunk_alloc(trans, chunk_root,
BTRFS_BLOCK_GROUP_DATA);
btrfs_end_transaction(trans, chunk_root);
if (ret < 0) {
mutex_unlock(&fs_info->delete_unused_bgs_mutex);
goto error;
}

btrfs_end_transaction(trans, chunk_root);
chunk_reserved = 1;
}

Expand Down

0 comments on commit 8a7d656

Please sign in to comment.