aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDongsheng Yang <yangds.fnst@cn.fujitsu.com>2014-11-20 20:58:34 -0500
committerChris Mason <clm@fb.com>2015-04-13 10:52:40 -0400
commite8c8541ac379709db8d2339e1cb720469fc2cd8f (patch)
tree1d58f1b000b8057fdbb34514083a464f6e39904b /fs
parent3eeb4d597efc9e068902057f1bd040cffc69e9e6 (diff)
btrfs: qgroup: update qgroup in memory at the same time when we update it in btree.
When we call btrfs_qgroup_inherit() with BTRFS_QGROUP_INHERIT_SET_LIMITS, btrfs will update the limit info of qgroup in btree but forget to update the qgroup in rbtree at the same time. It obviousely will cause an inconsistency. This patch fix it by updating the rbtree at the same time. Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/qgroup.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 34c2753fa4e1..bf926f766273 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -2230,17 +2230,6 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans,
2230 if (ret) 2230 if (ret)
2231 goto out; 2231 goto out;
2232 2232
2233 if (inherit && inherit->flags & BTRFS_QGROUP_INHERIT_SET_LIMITS) {
2234 ret = update_qgroup_limit_item(trans, quota_root, objectid,
2235 inherit->lim.flags,
2236 inherit->lim.max_rfer,
2237 inherit->lim.max_excl,
2238 inherit->lim.rsv_rfer,
2239 inherit->lim.rsv_excl);
2240 if (ret)
2241 goto out;
2242 }
2243
2244 if (srcid) { 2233 if (srcid) {
2245 struct btrfs_root *srcroot; 2234 struct btrfs_root *srcroot;
2246 struct btrfs_key srckey; 2235 struct btrfs_key srckey;
@@ -2286,6 +2275,23 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans,
2286 goto unlock; 2275 goto unlock;
2287 } 2276 }
2288 2277
2278 if (inherit && inherit->flags & BTRFS_QGROUP_INHERIT_SET_LIMITS) {
2279 ret = update_qgroup_limit_item(trans, quota_root, objectid,
2280 inherit->lim.flags,
2281 inherit->lim.max_rfer,
2282 inherit->lim.max_excl,
2283 inherit->lim.rsv_rfer,
2284 inherit->lim.rsv_excl);
2285 if (ret)
2286 goto unlock;
2287
2288 dstgroup->lim_flags = inherit->lim.flags;
2289 dstgroup->max_rfer = inherit->lim.max_rfer;
2290 dstgroup->max_excl = inherit->lim.max_excl;
2291 dstgroup->rsv_rfer = inherit->lim.rsv_rfer;
2292 dstgroup->rsv_excl = inherit->lim.rsv_excl;
2293 }
2294
2289 if (srcid) { 2295 if (srcid) {
2290 srcgroup = find_qgroup_rb(fs_info, srcid); 2296 srcgroup = find_qgroup_rb(fs_info, srcid);
2291 if (!srcgroup) 2297 if (!srcgroup)