From patchwork Wed Nov 18 16:50:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 7650961 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 CAB8DC05CA 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 D98952060B for ; Wed, 18 Nov 2015 16:50:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 78BC9205F5 for ; Wed, 18 Nov 2015 16:50:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755480AbbKRQuj (ORCPT ); Wed, 18 Nov 2015 11:50:39 -0500 Received: from mail-qg0-f53.google.com ([209.85.192.53]:35183 "EHLO mail-qg0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751496AbbKRQui (ORCPT ); Wed, 18 Nov 2015 11:50:38 -0500 Received: by qgec40 with SMTP id c40so31855020qge.2 for ; Wed, 18 Nov 2015 08:50:37 -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:in-reply-to:references; bh=NzQGBNHQd6M/AppPnqiwwrDoq8GhZvn+ZYY9aGhBlig=; b=BvE/Zb0rNmiknMBTaywT0B7+8BQF8383AzGUUMLiwm89d/FeZfxiVTnqgHBwDw6bhF +WhZwp5Ki/E21kttfs1KR9KB5+j9qobDR2RQpaU8s0ZqoWuYVYl2vijg76rc4rTmBHhg GX/tiULRA4BTYrnxozrNEEe/RIDs49MCTo0zndS10G+dBalwkvZwKNuL5rLjLbfqaXa/ Ub5m64PARNd+RWb/wm7sXutv5gRgrlAtTcq/vIQ5zxeD8V6wrgeWikfWY/1VGCTgAaGf ZuOWzOdcqzILdvy1ueq4TRRyGpXyYibasVMD/HCZaNa+04f0tG8P5smoUKTwC9WXIFu9 e6Mw== 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:in-reply-to :references; bh=NzQGBNHQd6M/AppPnqiwwrDoq8GhZvn+ZYY9aGhBlig=; b=QpQDANmBf0/pP+zsVjtN1qMl6rhEgJE/CjkA08nCJTJgVxYQydo+0JgDzwXrEeR3KQ 0GYeWfbFlBYI+0QCnlLGEtDLHSg49iBBkw0BfbbSQ7ibp68oC86TiMkV2YNf9ydUrMiV TM1JJVWYp+7FWxtKzRTSNORpxv8Csd6a/g2gIENBAfaNKXoV+AfgTgH5aDnbuqsF47rj 8lrtRbDvOX+EonA3lpbRJzZUl7ZrlmTofNzmZ+5NPbRtjmYlvrNCbfh36YBlbmpQVYlt SlZ/nC0z2EADT6fdjtibmGqs8e0Of38mjhezWeiPzIzSHxg9c9iGmd53gZTMUbNSXB7I U11w== X-Gm-Message-State: ALoCoQlKDPfRDuY33aYcmC3lkvq/iAhoDfbbPEqcZC8Q0sfgS/lKLp/bL1w42ZuFkoKtZmDh1dXc X-Received: by 10.140.41.210 with SMTP id z76mr2476088qgz.81.1447865437569; Wed, 18 Nov 2015 08:50:37 -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.36 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 18 Nov 2015 08:50:36 -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 2/2] exportfs: vet exports for subtree checking when testing the export fails Date: Wed, 18 Nov 2015 11:50:30 -0500 Message-Id: <1447865430-28434-2-git-send-email-jeff.layton@primarydata.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1447865430-28434-1-git-send-email-jeff.layton@primarydata.com> References: <1447865430-28434-1-git-send-email-jeff.layton@primarydata.com> 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 I have a proposed kernel patch that would allow filesystems (such as NFS) to opt out of subtree checking when they are exported. We do want to warn people at export time however if that doesn't work. If we issued a test_export that fails and don't have NFSEXP_NOSUBTREECHECK already set in it, then try it again with that set. If that works then we know that the filesystem requires NFSEXP_NOSUBTREECHECK be set. Cc: Neil Brown Signed-off-by: Jeff Layton --- utils/exportfs/exportfs.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c index cac01fc25f9a..1b704e85c024 100644 --- a/utils/exportfs/exportfs.c +++ b/utils/exportfs/exportfs.c @@ -557,6 +557,20 @@ static int test_export(char *path, int opts) } static void +validate_subtree_check(nfs_export *exp) +{ + char *path = exp->m_export.e_path; + + if (!(exp->m_export.e_flags & NFSEXP_NOSUBTREECHECK)) { + if (test_export(path, exp->m_export.e_flags | NFSEXP_NOSUBTREECHECK)) { + xlog(L_ERROR, "%s does not support subtree checking", path); + return; + } + } + xlog(L_ERROR, "%s does not support NFS export", path); +} + +static void validate_export(nfs_export *exp) { /* Check that the given export point is potentially exportable. @@ -587,16 +601,13 @@ 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, exp->m_export.e_flags)) { - xlog(L_ERROR, "%s does not support NFS export", path); - return; - } - } else if ( ! test_export(path, exp->m_export.e_flags)) { + if (!test_export(path, exp->m_export.e_flags)) + validate_subtree_check(exp); + } 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); - return; + validate_subtree_check(exp); } }