From patchwork Wed Nov 18 16:50:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 7650951 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 60EE3BF90C for ; Wed, 18 Nov 2015 16:50:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 77888205F2 for ; Wed, 18 Nov 2015 16:50:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 24DF4205B1 for ; Wed, 18 Nov 2015 16:50:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752805AbbKRQui (ORCPT ); Wed, 18 Nov 2015 11:50:38 -0500 Received: from mail-qg0-f47.google.com ([209.85.192.47]:35170 "EHLO mail-qg0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751496AbbKRQuh (ORCPT ); Wed, 18 Nov 2015 11:50:37 -0500 Received: by qgec40 with SMTP id c40so31854593qge.2 for ; Wed, 18 Nov 2015 08:50:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poochiereds-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=msKnvq7FRh5lbw+7MpOv//RDeUbp4xDSmX5yv5+pIhw=; b=cm3ik8xSebw7u3rpkPM27uJrKS/GZm3qfsYM/GheDx5Ve2KGKLQJgYq7YWYqlVqy2I oLycvfnlFc1cSONu0rfub0CpsT0gD1Gy3LqNxw1TGgzylratjJypAs6MEuPM26GNiLIU 7sk29ySQfBx6rEbHAzuhBW132qyItRFLdR1NyQV4BXGpDvxZJKV3xzi3bt4d212oVSm/ kIeoazkhHS+QiFsoSEBSVBVzPWJx/ENxwg2uDcAf55bkLrTQBwtn4R9gdqD95hj5QYiV rajDQPpjjObrkZQgEJ7flI/c4PApGxUR2A7TOPHJLoujIOVgqFSsahPmIm8D9wieU9XH bRjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=msKnvq7FRh5lbw+7MpOv//RDeUbp4xDSmX5yv5+pIhw=; b=ZHuZnA6/AFh6YmUkxz2DifRboWwsFv2h8e0SgGwPV8Qa3h9A0kpyl8mZsXUCw2vSTf A1rSoAZV1QBM67z38UzlsNzdLHD2jeFh+Ls1FKd7IEB8oLGgBV6lKAZtwWY97nLKA43A aSFp0h/aVPQ8tHr453itybnL4JIyPyiYIWmDyVhauPbqLfQYb95DT8mkVoS37fw59ey1 pxuzfasBdf3uopn0rNPPTiL8zgXfrc93xvEBbZdZYsyq2woAdSOoJRPGmMasdVbPIyCi 7WtfLzU4/3MXi3vIopNmQ80OKlDZ/ih04hJopMSG+UXmjcneqGDiT7ZI9AXx2kmqc6MZ jC8w== X-Gm-Message-State: ALoCoQkdI7meVZxqriqWfcrmD3ng28/6Kh7dPTCrS4WUkVMvuADBTcytji++1/AAKQSq3PpsrVo+ X-Received: by 10.140.104.19 with SMTP id z19mr2467190qge.75.1447865436545; Wed, 18 Nov 2015 08:50:36 -0800 (PST) Received: from tlielax.poochiereds.net ([2606:a000:1125:4075::d5a]) by smtp.googlemail.com with ESMTPSA id b67sm1113015qgb.19.2015.11.18.08.50.35 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 18 Nov 2015 08:50:35 -0800 (PST) From: Jeff Layton X-Google-Original-From: Jeff Layton To: steved@redhat.com Cc: neilb@suse.de, linux-nfs@vger.kernel.org, bfields@fieldses.org Subject: [RFC PATCH 1/2] exportfs: pass export option flags to the kernel when testing export Date: Wed, 18 Nov 2015 11:50:29 -0500 Message-Id: <1447865430-28434-1-git-send-email-jeff.layton@primarydata.com> X-Mailer: git-send-email 2.4.3 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP test_export takes a flag that just says whether to pass in the fsid or not. This means that all we can test is the NFSEXP_FSIDi flag. Instead of doing that, pass in the actual export options that we intend to use (sometimes or'ed with NFSEXP_FSID to test whether that might be the reason for the failure). This allows us to test the actual export options that we plan to use, and can allow the kernel to vet them properly before mount time. The rationale here is a patch that I have that will add the ability for filesystems to opt out of subtree checking when they can't properly support it. Cc: Neil Brown Signed-off-by: Jeff Layton --- utils/exportfs/exportfs.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c index c7a79a69b5d6..cac01fc25f9a 100644 --- a/utils/exportfs/exportfs.c +++ b/utils/exportfs/exportfs.c @@ -531,7 +531,7 @@ static int can_test(void) return 1; } -static int test_export(char *path, int with_fsid) +static int test_export(char *path, int opts) { /* beside max path, buf size should take protocol str into account */ char buf[NFS_MAXPATHLEN+1+64] = { 0 }; @@ -545,7 +545,7 @@ static int test_export(char *path, int with_fsid) qword_add(&bp, &len, path); if (len < 1) return 0; - snprintf(bp, len, " 3 %d 65534 65534 0\n", with_fsid ? NFSEXP_FSID : 0); + snprintf(bp, len, " 3 %d 65534 65534 0\n", opts); fd = open("/proc/net/rpc/nfsd.export/channel", O_WRONLY); if (fd < 0) return 0; @@ -587,12 +587,12 @@ validate_export(nfs_export *exp) if ((exp->m_export.e_flags & NFSEXP_FSID) || exp->m_export.e_uuid || fs_has_fsid) { - if ( !test_export(path, 1)) { + if ( !test_export(path, exp->m_export.e_flags)) { xlog(L_ERROR, "%s does not support NFS export", path); return; } - } else if ( ! test_export(path, 0)) { - if (test_export(path, 1)) + } else if ( ! test_export(path, exp->m_export.e_flags)) { + if (test_export(path, exp->m_export.e_flags & NFSEXP_FSID)) xlog(L_ERROR, "%s requires fsid= for NFS export", path); else xlog(L_ERROR, "%s does not support NFS export", path);