Btrfs: don't leak block group on error
authorFilipe David Borba Manana <fdmanana@gmail.com>
Mon, 9 Sep 2013 18:49:43 +0000 (19:49 +0100)
committerChris Mason <chris.mason@fusionio.com>
Tue, 12 Nov 2013 02:53:15 +0000 (21:53 -0500)
In extent-tree.c:btrfs_write_dirty_block_groups(), if the call to
write_one_cache_group() failed, we would return without putting
the block group first.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
fs/btrfs/extent-tree.c

index 55b537fcb81a2d53aad897194117a6fb07cd3c16..54ee542c705ea5f1c651f4f4e737c7d772433cbb 100644 (file)
@@ -3317,10 +3317,9 @@ again:
                last = cache->key.objectid + cache->key.offset;
 
                err = write_one_cache_group(trans, root, path, cache);
+               btrfs_put_block_group(cache);
                if (err) /* File system offline */
                        goto out;
-
-               btrfs_put_block_group(cache);
        }
 
        while (1) {