From patchwork Thu Sep 15 19:57:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill O'Donnell X-Patchwork-Id: 9334677 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 634C86077F for ; Thu, 15 Sep 2016 19:57:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5604529B2C for ; Thu, 15 Sep 2016 19:57:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4AD5129B35; Thu, 15 Sep 2016 19:57:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from oss.sgi.com (oss.sgi.com [192.48.182.195]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B277529B2C for ; Thu, 15 Sep 2016 19:57:56 +0000 (UTC) Received: from oss.sgi.com (localhost [IPv6:::1]) by oss.sgi.com (Postfix) with ESMTP id 3B0FD7CA1; Thu, 15 Sep 2016 14:57:55 -0500 (CDT) X-Original-To: xfs@oss.sgi.com Delivered-To: xfs@oss.sgi.com Received: from relay.sgi.com (relay2.corp.sgi.com [137.38.102.29]) by oss.sgi.com (Postfix) with ESMTP id C40327CA0 for ; Thu, 15 Sep 2016 14:57:53 -0500 (CDT) Received: from cuda.sgi.com (cuda1.sgi.com [192.48.157.11]) by relay2.corp.sgi.com (Postfix) with ESMTP id 84F64304062 for ; Thu, 15 Sep 2016 12:57:53 -0700 (PDT) X-ASG-Debug-ID: 1473969471-0bf815415c223430001-NocioJ Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by cuda.sgi.com with ESMTP id AbM0qv0a3gekFz8F (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 15 Sep 2016 12:57:52 -0700 (PDT) X-Barracuda-Envelope-From: billodo@redhat.com X-Barracuda-Effective-Source-IP: mx1.redhat.com[209.132.183.28] X-Barracuda-Apparent-Source-IP: 209.132.183.28 X-ASG-Whitelist: Client Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8179B7F7B6; Thu, 15 Sep 2016 19:57:51 +0000 (UTC) Received: from localhost.localdomain.com (vpn-53-201.rdu2.redhat.com [10.10.53.201]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8FJvoQA019883; Thu, 15 Sep 2016 15:57:50 -0400 From: "Bill O'Donnell" To: linux-xfs@vger.kernel.org Subject: [PATCH v3 3/3] xfs_quota: add case for foreign fs, disabled regardless of foreign_allowed Date: Thu, 15 Sep 2016 14:57:49 -0500 X-ASG-Orig-Subj: [PATCH v3 3/3] xfs_quota: add case for foreign fs, disabled regardless of foreign_allowed Message-Id: <1473969469-27354-1-git-send-email-billodo@redhat.com> In-Reply-To: <1473953386-10242-4-git-send-email-billodo@redhat.com> References: <1473953386-10242-4-git-send-email-billodo@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 15 Sep 2016 19:57:51 +0000 (UTC) X-Barracuda-Connect: mx1.redhat.com[209.132.183.28] X-Barracuda-Start-Time: 1473969472 X-Barracuda-Encrypted: ECDHE-RSA-AES256-GCM-SHA384 X-Barracuda-URL: https://192.48.157.11:443/cgi-mod/mark.cgi X-Barracuda-Scan-Msg-Size: 1825 X-Virus-Scanned: by bsmtpd at sgi.com X-Barracuda-BRTS-Status: 1 Cc: xfs@oss.sgi.com X-BeenThere: xfs@oss.sgi.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: XFS Filesystem from SGI List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xfs-bounces@oss.sgi.com Sender: xfs-bounces@oss.sgi.com X-Virus-Scanned: ClamAV using ClamSMTP Some commands are disallowed for foreign filesystems, regardless of whether or not the -f flag is thrown. Add a case for this condition and improve commenting and output messaging accordingly in init_check_command. Signed-off-by: Bill O'Donnell Reviewed-by: Eric Sandeen --- history: v3: clarify foreign filesystem user output message. v2: no change v1: http://www.spinics.net/lists/linux-xfs/msg00685.html quota/init.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/quota/init.c b/quota/init.c index 2c18c8b..3bebbb8 100644 --- a/quota/init.c +++ b/quota/init.c @@ -112,21 +112,29 @@ init_check_command( if (!fs_path) return 1; - /* Always run commands that we are told to skip here */ + /* Always run commands that are valid for all fs types. */ if (ct->flags & CMD_ALL_FSTYPES) return 1; - /* if it's an XFS filesystem, always run the command */ + /* If it's an XFS filesystem, always run the command. */ if (!(fs_path->fs_flags & FS_FOREIGN)) return 1; - /* If the user specified foreign filesysetms are ok, run it */ + /* If the user specified foreign filesystems are ok (-f), run cmd. */ if (foreign_allowed && (ct->flags & CMD_FLAG_FOREIGN_OK)) return 1; - /* foreign filesystem and it's not a valid command! */ - fprintf(stderr, _("%s command is for XFS filesystems only\n"), + /* If cmd not allowed on foreign fs, regardless of -f flag, skip it. */ + if (!(ct->flags & CMD_FLAG_FOREIGN_OK)) { + fprintf(stderr, _("%s: command is for XFS filesystems only\n"), + ct->name); + return 0; + } + + /* foreign fs, but cmd only allowed via -f flag. Skip it. */ + fprintf(stderr, + _("%s: foreign filesystem. Invoke xfs_quota with -f to enable.\n"), ct->name); return 0; }