Btrfs: fix the qgroup reserved space is released prematurely
authorMiao Xie <miaox@cn.fujitsu.com>
Wed, 20 Feb 2013 09:13:32 +0000 (09:13 +0000)
committerJosef Bacik <jbacik@fusionio.com>
Wed, 20 Feb 2013 18:00:02 +0000 (13:00 -0500)
In start_transactio(), we will try to join the transaction again after
the current transaction is committed, so we should not release the
reserved space of the qgroup. Fix it.

Cc: Arne Jansen <sensille@gmx.net>
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
fs/btrfs/transaction.c

index 0c87d18d18814ec2424997778a3d520b3f16de4b..425d5b57d377c8f5963dcf8dd028ead7c5ed2db0 100644 (file)
@@ -383,7 +383,7 @@ again:
        h->block_rsv = NULL;
        h->orig_rsv = NULL;
        h->aborted = 0;
-       h->qgroup_reserved = qgroup_reserved;
+       h->qgroup_reserved = 0;
        h->delayed_ref_elem.seq = 0;
        h->type = type;
        h->allocating_chunk = false;
@@ -402,6 +402,7 @@ again:
                h->block_rsv = &root->fs_info->trans_block_rsv;
                h->bytes_reserved = num_bytes;
        }
+       h->qgroup_reserved = qgroup_reserved;
 
 got_it:
        btrfs_record_root_in_trans(h, root);