From patchwork Thu Nov 8 09:55:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miao Xie X-Patchwork-Id: 1714791 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id D2294DF280 for ; Thu, 8 Nov 2012 09:55:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755142Ab2KHJzV (ORCPT ); Thu, 8 Nov 2012 04:55:21 -0500 Received: from cn.fujitsu.com ([222.73.24.84]:37619 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1752826Ab2KHJzU (ORCPT ); Thu, 8 Nov 2012 04:55:20 -0500 X-IronPort-AV: E=Sophos;i="4.80,737,1344182400"; d="scan'208";a="6161446" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 08 Nov 2012 17:53:41 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id qA89tIYF003748; Thu, 8 Nov 2012 17:55:18 +0800 Received: from [10.167.225.199] ([10.167.225.199]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2012110817552329-1024335 ; Thu, 8 Nov 2012 17:55:23 +0800 Message-ID: <509B8197.2090601@cn.fujitsu.com> Date: Thu, 08 Nov 2012 17:55:35 +0800 From: Miao Xie Reply-To: miaox@cn.fujitsu.com User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121016 Thunderbird/16.0.1 MIME-Version: 1.0 To: Linux Btrfs CC: Arne Jansen , wangshilong Subject: [RFC PATCH] Btrfs-progs: disable qgroupid 0 for quota_tree References: <509B8053.3080509@cn.fujitsu.com> In-Reply-To: <509B8053.3080509@cn.fujitsu.com> X-Forwarded-Message-Id: <509B8053.3080509@cn.fujitsu.com> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/11/08 17:55:23, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/11/08 17:55:23, Serialize complete at 2012/11/08 17:55:23 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org From: Wang Shilong In kernel, qgroupid 0 is a special number when we run the quota group limit command. So, we should not be able to create a quota group whose id is 0, otherwise the kernel can't deal with it. Fix it. Signed-off-by: Wang Shilong Signed-off-by: Miao Xie --- cmds-qgroup.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) -- 1.7.7.6 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/cmds-qgroup.c b/cmds-qgroup.c index 70019d0..dfff1b9 100644 --- a/cmds-qgroup.c +++ b/cmds-qgroup.c @@ -86,6 +86,10 @@ static int qgroup_create(int create, int argc, char **argv) args.create = create; args.qgroupid = parse_qgroupid(argv[1]); + if (!args.qgroupid) { + fprintf(stderr, "ERROR: qgroup 0 is not supported\n"); + return 30; + } fd = open_file_or_dir(path); if (fd < 0) { fprintf(stderr, "ERROR: can't access '%s'\n", path);