linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/4] Btrfs-progs: disable qgroup level 0 for userspace use
@ 2013-02-25 14:02 Wang Shilong
  0 siblings, 0 replies; only message in thread
From: Wang Shilong @ 2013-02-25 14:02 UTC (permalink / raw)
  To: linux-btrfs; +Cc: wangshilong1991

From: Wang Shilong <wangsl-fnst@cn.fujitsu.com>

To implement a strict hierarchy quota, qgroup level 0
should not be allowed to create/destroy by users.

Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
---
 cmds-qgroup.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/cmds-qgroup.c b/cmds-qgroup.c
index 26f0ab0..06505fa 100644
--- a/cmds-qgroup.c
+++ b/cmds-qgroup.c
@@ -86,6 +86,11 @@ static int qgroup_create(int create, int argc, char **argv)
 	memset(&args, 0, sizeof(args));
 	args.create = create;
 	args.qgroupid = parse_qgroupid(argv[1]);
+	if (!(args.qgroupid >> 48)) {
+		fprintf(stderr, "ERROR: unable to create/destroy qgroup "
+				"level 0\n");
+		return 30;
+	}
 
 	fd = open_file_or_dir(path);
 	if (fd < 0) {
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-02-25 14:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-25 14:02 [PATCH 2/4] Btrfs-progs: disable qgroup level 0 for userspace use Wang Shilong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).