Btrfs: fix warning when creating snapshots
authorLiu Bo <bo.li.liu@oracle.com>
Wed, 13 Mar 2013 13:43:03 +0000 (07:43 -0600)
committerChris Mason <chris.mason@fusionio.com>
Thu, 14 Mar 2013 18:57:30 +0000 (14:57 -0400)
Creating snapshot passes extent_root to commit its transaction,
but it can lead to the warning of checking root for quota in
the __btrfs_end_transaction() when someone else is committing
the current transaction.  Since we've recorded the needed root
in trans_handle, just use it to get rid of the warning.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
fs/btrfs/transaction.c

index fedede1fe178b46f087ae7ad9a00346cc997dc19..c4a1531c52d8ac5870270f3a1df6b30a73fa1652 100644 (file)
@@ -626,14 +626,13 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
 
        btrfs_trans_release_metadata(trans, root);
        trans->block_rsv = NULL;
-       /*
-        * the same root has to be passed to start_transaction and
-        * end_transaction. Subvolume quota depends on this.
-        */
-       WARN_ON(trans->root != root);
 
        if (trans->qgroup_reserved) {
-               btrfs_qgroup_free(root, trans->qgroup_reserved);
+               /*
+                * the same root has to be passed here between start_transaction
+                * and end_transaction. Subvolume quota depends on this.
+                */
+               btrfs_qgroup_free(trans->root, trans->qgroup_reserved);
                trans->qgroup_reserved = 0;
        }