]> git.hungrycats.org Git - linux/commitdiff
Btrfs: fix transaction handle leak in balance
authorFilipe Manana <fdmanana@suse.com>
Thu, 10 Dec 2015 11:08:59 +0000 (11:08 +0000)
committerZygo Blaxell <zblaxell@thirteen.furryterror.org>
Fri, 11 Dec 2015 03:33:08 +0000 (22:33 -0500)
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 <fdmanana@suse.com>
(cherry picked from commit 8a7d656f3dfb7889316ba57502f1eaa6106fd6f8)

fs/btrfs/volumes.c

index 84d7b995fc909ca3532a2e2aa19c4010f4a7ed14..6186348668dc8da0045821cb090191f4680c6394 100644 (file)
@@ -3398,12 +3398,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;
                }