btrfs: fix error handling in create_pending_snapshot
authorEric Sandeen <sandeen@redhat.com>
Thu, 12 Jun 2014 05:53:44 +0000 (00:53 -0500)
committerChris Mason <clm@fb.com>
Fri, 13 Jun 2014 16:52:30 +0000 (09:52 -0700)
fcebe456 cut and pasted some code to a later point
in create_pending_snapshot(), but didn't switch
to the appropriate error handling for this stage
of the function.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/transaction.c

index 9630f10..511839c 100644 (file)
@@ -1284,11 +1284,13 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
                goto fail;
        }
 
-       pending->error = btrfs_qgroup_inherit(trans, fs_info,
-                                             root->root_key.objectid,
-                                             objectid, pending->inherit);
-       if (pending->error)
-               goto no_free_objectid;
+       ret = btrfs_qgroup_inherit(trans, fs_info,
+                                  root->root_key.objectid,
+                                  objectid, pending->inherit);
+       if (ret) {
+               btrfs_abort_transaction(trans, root, ret);
+               goto fail;
+       }
 
        /* see comments in should_cow_block() */
        set_bit(BTRFS_ROOT_FORCE_COW, &root->state);