diff options
author | Dongsheng Yang <yangds.fnst@cn.fujitsu.com> | 2014-11-11 13:18:22 +0100 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2015-04-13 16:52:51 +0200 |
commit | 09870d2772b284d0061a5e4d1e1cdf6fb6764344 (patch) | |
tree | 165d3cbb7ab0be6a0c1ae1120658b31a8ad39f2b /fs/btrfs/qgroup.c | |
parent | btrfs: qgroup: do a reservation in a higher level. (diff) | |
download | linux-09870d2772b284d0061a5e4d1e1cdf6fb6764344.tar.xz linux-09870d2772b284d0061a5e4d1e1cdf6fb6764344.zip |
btrfs: qgroup: return EINVAL if level of parent is not higher than child's.
When we create a subvol inheriting a qgroup, we need to check the level
of them. Otherwise, there is a chance a qgroup can inherit another qgroup
at the same level.
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/qgroup.c')
-rw-r--r-- | fs/btrfs/qgroup.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index 17881ad8ed96..4ec86b3eee21 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -2230,6 +2230,11 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans, ret = -EINVAL; goto out; } + + if ((srcgroup->qgroupid >> 48) <= (objectid >> 48)) { + ret = -EINVAL; + goto out; + } ++i_qgroups; } } |