]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
Btrfs: don't steal the reserved space from the global reserve if their space type...
authorMiao Xie <miaox@cn.fujitsu.com>
Mon, 13 May 2013 13:55:11 +0000 (13:55 +0000)
committerJosef Bacik <jbacik@fusionio.com>
Sat, 18 May 2013 01:40:25 +0000 (21:40 -0400)
If the type of the space we need is different with the global reserve, we
can not steal the space from the global reserve, because we can not allocate
the space from the free space cache that the global reserve points to.

Cc: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
fs/btrfs/extent-tree.c

index 5e2c0bf84075d2248135e04a7be4447e7f55aba1..54e63b273a64a5ef035ea26865a55daea076376a 100644 (file)
@@ -6681,9 +6681,11 @@ try_reserve:
                return block_rsv;
        /*
         * If we couldn't reserve metadata bytes try and use some from
-        * the global reserve.
+        * the global reserve if its space type is the same as the global
+        * reservation.
         */
-       if (block_rsv->type != BTRFS_BLOCK_RSV_GLOBAL) {
+       if (block_rsv->type != BTRFS_BLOCK_RSV_GLOBAL &&
+           block_rsv->space_info == global_rsv->space_info) {
                ret = block_rsv_use_bytes(global_rsv, blocksize);
                if (!ret)
                        return global_rsv;