Btrfs: Fix a few functions that exit without stopping their transaction
authorJosef Bacik <jbacik@redhat.com>
Thu, 24 Jul 2008 16:17:14 +0000 (12:17 -0400)
committerChris Mason <chris.mason@oracle.com>
Thu, 25 Sep 2008 15:04:05 +0000 (11:04 -0400)
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/extent-tree.c
fs/btrfs/ioctl.c

index f92b297e7da5f8a96d81df20689e026cb63b0b89..e6a3ba9dd1079f595987212a23cf20c87845a735 100644 (file)
@@ -3275,8 +3275,10 @@ next:
        ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
        if (ret > 0)
                ret = -EIO;
-       if (ret < 0)
+       if (ret < 0) {
+               btrfs_end_transaction(trans, root);
                goto out;
+       }
 
        clear_extent_bits(&info->block_group_cache, key.objectid,
                          key.objectid + key.offset - 1,
index faf081302d024e6a947bf403b8158eae61913267..7d40778a90e4b5f6533e41ed7c851032d77d3917 100644 (file)
@@ -78,8 +78,10 @@ static noinline int create_subvol(struct btrfs_root *root, char *name,
        leaf = btrfs_alloc_free_block(trans, root, root->leafsize,
                                      objectid, trans->transid, 0, 0,
                                      0, 0);
-       if (IS_ERR(leaf))
-               return PTR_ERR(leaf);
+       if (IS_ERR(leaf)) {
+               ret = PTR_ERR(leaf);
+               goto fail;
+       }
 
        btrfs_set_header_nritems(leaf, 0);
        btrfs_set_header_level(leaf, 0);