From patchwork Mon Aug 29 13:40:12 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: 9304031 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 8031B60756 for ; Mon, 29 Aug 2016 13:40:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 71ED7286B8 for ; Mon, 29 Aug 2016 13:40:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 66775286CD; Mon, 29 Aug 2016 13:40:21 +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 D2EFD286B8 for ; Mon, 29 Aug 2016 13:40:20 +0000 (UTC) Received: from oss.sgi.com (localhost [IPv6:::1]) by oss.sgi.com (Postfix) with ESMTP id 96ADF7CA1; Mon, 29 Aug 2016 08:40:19 -0500 (CDT) X-Original-To: xfs@oss.sgi.com Delivered-To: xfs@oss.sgi.com Received: from relay.sgi.com (relay1.corp.sgi.com [137.38.102.111]) by oss.sgi.com (Postfix) with ESMTP id 4C5007CA0 for ; Mon, 29 Aug 2016 08:40:18 -0500 (CDT) Received: from cuda.sgi.com (cuda1.sgi.com [192.48.157.11]) by relay1.corp.sgi.com (Postfix) with ESMTP id 1184B8F8033 for ; Mon, 29 Aug 2016 06:40:17 -0700 (PDT) X-ASG-Debug-ID: 1472478013-0bf8155c74302980001-NocioJ Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by cuda.sgi.com with ESMTP id qz56OcRQxMfwDiiY (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Mon, 29 Aug 2016 06:40:13 -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-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (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 752FDC057FA6 for ; Mon, 29 Aug 2016 13:40:13 +0000 (UTC) Received: from localhost.localdomain.com (vpn-60-194.rdu2.redhat.com [10.10.60.194]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u7TDeC8b010745 for ; Mon, 29 Aug 2016 09:40:13 -0400 From: "Bill O'Donnell" To: xfs@oss.sgi.com Subject: [PATCH] xfsprogs: don't populate fs table with foreign fs paths unless foreign_allowed Date: Mon, 29 Aug 2016 08:40:12 -0500 X-ASG-Orig-Subj: [PATCH] xfsprogs: don't populate fs table with foreign fs paths unless foreign_allowed Message-Id: <1472478012-23627-1-git-send-email-billodo@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 29 Aug 2016 13:40:13 +0000 (UTC) X-Barracuda-Connect: mx1.redhat.com[209.132.183.28] X-Barracuda-Start-Time: 1472478013 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: 1682 X-Virus-Scanned: by bsmtpd at sgi.com X-Barracuda-BRTS-Status: 1 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 Commits b20b6c2 and 29647c8 modified xfs_quota for use on non-XFS filesystems. One modification in fs_initialise_mounts (paths.c) resulted in an xfstest fail (xfs/261), due to foreign fs paths entering the fs table. This patch reverts the behavior in fs_initialise_mounts back to skip populating the table with foreign paths, unless the -f flag is thrown in xfs_quota to set foreign_allowed true. Signed-off-by: Bill O'Donnell --- libxcmd/paths.c | 5 +++++ quota/init.c | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libxcmd/paths.c b/libxcmd/paths.c index 4158688..7375c0e 100644 --- a/libxcmd/paths.c +++ b/libxcmd/paths.c @@ -34,6 +34,7 @@ extern char *progname; int fs_count; struct fs_path *fs_table; struct fs_path *fs_path; +bool foreign_allowed = false; /* foreign filesystems not allowed (default) */ char *mtab_file; #define PROC_MOUNTS "/proc/self/mounts" @@ -311,6 +312,10 @@ fs_table_initialise_mounts( return errno; while ((mnt = getmntent(mtp)) != NULL) { + /* don't populate if not XFS, and foreign fs disallowed */ + if ((strcmp(mnt->mnt_type, "xfs") != 0) && + !foreign_allowed) + continue; if (!realpath(mnt->mnt_dir, rmnt_dir)) continue; if (!realpath(mnt->mnt_fsname, rmnt_fsname)) diff --git a/quota/init.c b/quota/init.c index 44be322..65e4dad 100644 --- a/quota/init.c +++ b/quota/init.c @@ -24,7 +24,6 @@ char *progname; int exitcode; int expert; -bool foreign_allowed = false; static char **projopts; /* table of project names (cmdline) */ static int nprojopts; /* number of entries in name table. */