Skip to content

Commit

Permalink
btrfs: qgroup: return EINVAL if level of parent is not higher than ch…
Browse files Browse the repository at this point in the history
…ild'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>
  • Loading branch information
Dongsheng Yang authored and Chris Mason committed Apr 13, 2015
1 parent e2d1f92 commit 09870d2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fs/btrfs/qgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 09870d2

Please sign in to comment.