From patchwork Sun Jan 20 21:04:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gene Czarcinski X-Patchwork-Id: 2008571 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id A9B0C3FED4 for ; Sun, 20 Jan 2013 21:04:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752558Ab3ATVEn (ORCPT ); Sun, 20 Jan 2013 16:04:43 -0500 Received: from eastrmfepo102.cox.net ([68.230.241.214]:41463 "EHLO eastrmfepo102.cox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752547Ab3ATVEn (ORCPT ); Sun, 20 Jan 2013 16:04:43 -0500 Received: from eastrmimpo209 ([68.230.241.224]) by eastrmfepo102.cox.net (InterMail vM.8.01.04.00 201-2260-137-20101110) with ESMTP id <20130120210442.OLRR7113.eastrmfepo102.cox.net@eastrmimpo209> for ; Sun, 20 Jan 2013 16:04:42 -0500 Received: from falcon.lcl ([68.100.144.189]) by eastrmimpo209 with cox id qM4W1k00945PsQc01M4hi0; Sun, 20 Jan 2013 16:04:42 -0500 X-CT-Class: Clean X-CT-Score: 0.00 X-CT-RefID: str=0001.0A020203.50FC5BEA.0033,ss=1,re=0.000,fgs=0 X-CT-Spam: 0 X-Authority-Analysis: v=2.0 cv=E5JPVNhl c=1 sm=1 a=xiXiwr23JuvKlkj6ngz4TA==:17 a=Wf-57Sph-yUA:10 a=103jMkqsgCkA:10 a=BIJj-m-0AAAA:8 a=Gf7A1_8osFEA:10 a=omOdbC7AAAAA:8 a=GV6gYbJfUYiirMhVW9kA:9 a=LUue1KWhiSUA:10 a=Ewy1R2rrY4dy71Y-:21 a=DXloCYgg0uDp4_OA:21 a=xiXiwr23JuvKlkj6ngz4TA==:117 X-CM-Score: 0.00 Authentication-Results: cox.net; auth=pass (CRAM-MD5) smtp.auth=gczarcinski@cox.net From: Gene Czarcinski To: linux-btrfs@vger.kernel.org Cc: Wang Shilong , Miao Xie , Gene Czarcinski Subject: [PATCH 12/13] Btrfs-progs: disable qgroupid 0 for quota_tree Date: Sun, 20 Jan 2013 16:04:17 -0500 Message-Id: <1358715858-4469-13-git-send-email-gene@czarc.net> X-Mailer: git-send-email 1.8.1 In-Reply-To: <1358715858-4469-1-git-send-email-gene@czarc.net> References: <1358715858-4469-1-git-send-email-gene@czarc.net> 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 Signed-off-by: Gene Czarcinski --- cmds-qgroup.c | 4 ++++ 1 file changed, 4 insertions(+) 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);