Btrfs: fix transaction handle leak in balance
PATCH 1/1 Btrfs: fix transaction handle leak in balance
From: Filipe Manana <[email protected]>
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 2c9fe8355258 ("btrfs: Fix lost-data-profile caused by balance bg")
Signed-off-by Filipe Manana <[email protected]>
--- fs/btrfs/volumes.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/btrfs/volumes.c +1 -2
@@ -3548,12 +3548,11 @@ again: 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 ; }
Signature · 1 line
2.1.3
Quoted 5 lines · On Thu, Dec 10, 2015 at 11:16:27AM +0000, [email protected] wrote:
From: Filipe Manana <[email protected]>
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.
Looks good.
Reviewed-by Liu Bo <[email protected]>
Thanks,
-liubo
Quoted 32 lines
Fixes 2c9fe8355258 ("btrfs: Fix lost-data-profile caused by balance bg")Signed-off-by Filipe Manana <[email protected]>--- fs/btrfs/volumes.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)fs/btrfs/volumes.c +1
-2@@ -3548,12 +3548,11 @@ again: 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 ; }Signature · 6 lines
2.1.3 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html