]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
Btrfs: check the root passed to btrfs_end_transaction
authorArne Jansen <sensille@gmx.net>
Tue, 13 Sep 2011 09:40:09 +0000 (11:40 +0200)
committerJan Schmidt <list.btrfs@jan-o-sch.net>
Tue, 10 Jul 2012 13:14:43 +0000 (15:14 +0200)
This patch only add a consistancy check to validate that the
same root is passed to start_transaction and end_transaction.
Subvolume quota depends on this.

Signed-off-by: Arne Jansen <sensille@gmx.net>
fs/btrfs/transaction.c
fs/btrfs/transaction.h

index 621c8dc48fb6d3513407c8b6e4da7bbb5f8d1c37..23cbda0685b800d14a2deb9fc1ea24da9d14d937 100644 (file)
@@ -345,6 +345,7 @@ again:
        h->transaction = cur_trans;
        h->blocks_used = 0;
        h->bytes_reserved = 0;
+       h->root = root;
        h->delayed_ref_updates = 0;
        h->use_count = 1;
        h->block_rsv = NULL;
@@ -511,6 +512,11 @@ 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);
        while (count < 2) {
                unsigned long cur = trans->delayed_ref_updates;
                trans->delayed_ref_updates = 0;
index fe27379e368bf43c53927d37fa1c32a4f67f05d0..010729446e130437bc27a94fa6618a4529cb52d7 100644 (file)
@@ -57,6 +57,12 @@ struct btrfs_trans_handle {
        struct btrfs_block_rsv *block_rsv;
        struct btrfs_block_rsv *orig_rsv;
        int aborted;
+       /*
+        * this root is only needed to validate that the root passed to
+        * start_transaction is the same as the one passed to end_transaction.
+        * Subvolume quota depends on this
+        */
+       struct btrfs_root *root;
 };
 
 struct btrfs_pending_snapshot {