aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/qgroup.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/qgroup.c')
-rw-r--r--fs/btrfs/qgroup.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index aee4b1cc3d98..b44124dd2370 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -1153,7 +1153,7 @@ int btrfs_qgroup_account_ref(struct btrfs_trans_handle *trans,
1153 ret = btrfs_find_all_roots(trans, fs_info, node->bytenr, 1153 ret = btrfs_find_all_roots(trans, fs_info, node->bytenr,
1154 sgn > 0 ? node->seq - 1 : node->seq, &roots); 1154 sgn > 0 ? node->seq - 1 : node->seq, &roots);
1155 if (ret < 0) 1155 if (ret < 0)
1156 goto out; 1156 return ret;
1157 1157
1158 spin_lock(&fs_info->qgroup_lock); 1158 spin_lock(&fs_info->qgroup_lock);
1159 quota_root = fs_info->quota_root; 1159 quota_root = fs_info->quota_root;
@@ -1275,7 +1275,6 @@ int btrfs_qgroup_account_ref(struct btrfs_trans_handle *trans,
1275 ret = 0; 1275 ret = 0;
1276unlock: 1276unlock:
1277 spin_unlock(&fs_info->qgroup_lock); 1277 spin_unlock(&fs_info->qgroup_lock);
1278out:
1279 ulist_free(roots); 1278 ulist_free(roots);
1280 ulist_free(tmp); 1279 ulist_free(tmp);
1281 1280
@@ -1525,21 +1524,23 @@ int btrfs_qgroup_reserve(struct btrfs_root *root, u64 num_bytes)
1525 1524
1526 if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_RFER) && 1525 if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_RFER) &&
1527 qg->reserved + qg->rfer + num_bytes > 1526 qg->reserved + qg->rfer + num_bytes >
1528 qg->max_rfer) 1527 qg->max_rfer) {
1529 ret = -EDQUOT; 1528 ret = -EDQUOT;
1529 goto out;
1530 }
1530 1531
1531 if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_EXCL) && 1532 if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_EXCL) &&
1532 qg->reserved + qg->excl + num_bytes > 1533 qg->reserved + qg->excl + num_bytes >
1533 qg->max_excl) 1534 qg->max_excl) {
1534 ret = -EDQUOT; 1535 ret = -EDQUOT;
1536 goto out;
1537 }
1535 1538
1536 list_for_each_entry(glist, &qg->groups, next_group) { 1539 list_for_each_entry(glist, &qg->groups, next_group) {
1537 ulist_add(ulist, glist->group->qgroupid, 1540 ulist_add(ulist, glist->group->qgroupid,
1538 (uintptr_t)glist->group, GFP_ATOMIC); 1541 (uintptr_t)glist->group, GFP_ATOMIC);
1539 } 1542 }
1540 } 1543 }
1541 if (ret)
1542 goto out;
1543 1544
1544 /* 1545 /*
1545 * no limits exceeded, now record the reservation into all qgroups 1546 * no limits exceeded, now record the reservation into all qgroups