From patchwork Thu Jul 14 02:26:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 9228809 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 579346086B for ; Thu, 14 Jul 2016 02:28:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45C1A25227 for ; Thu, 14 Jul 2016 02:28:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A5A827FBB; Thu, 14 Jul 2016 02:28:05 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E6D0325227 for ; Thu, 14 Jul 2016 02:28:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751205AbcGNC2D (ORCPT ); Wed, 13 Jul 2016 22:28:03 -0400 Received: from mx2.suse.de ([195.135.220.15]:57110 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750865AbcGNC2B (ORCPT ); Wed, 13 Jul 2016 22:28:01 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 8E991AC5D; Thu, 14 Jul 2016 02:28:00 +0000 (UTC) From: NeilBrown To: Steve Dickson Date: Thu, 14 Jul 2016 12:26:43 +1000 Subject: [PATCH 5/8] mountd: Don't export unmounted exports to NFSv4 Cc: Linux NFS Mailing list Message-ID: <20160714022643.5874.38987.stgit@noble> In-Reply-To: <20160714021310.5874.22953.stgit@noble> References: <20160714021310.5874.22953.stgit@noble> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP An export point with the "mountpoint" option should not be exported if it isn't a mount point. For NFSv3, this is handled primarily by failing the MOUNT request. For NFSv4, we must ensure a lookup from the pseduo-root fails too. This means nfsd_export must check for the 'mountpoint' option and handle it correctly. Signed-off-by: NeilBrown --- utils/mountd/cache.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c index f33f66640c6c..19e7607e4fb1 100644 --- a/utils/mountd/cache.c +++ b/utils/mountd/cache.c @@ -1321,7 +1321,12 @@ static void nfsd_export(int f) found = lookup_export(dom, path, ai); if (found) { - if (dump_to_cache(f, buf, sizeof(buf), dom, path, &found->m_export) < 0) { + if (found->m_export.e_mountpoint && + !is_mountpoint(found->m_export.e_mountpoint[0]? + found->m_export.e_mountpoint: + found->m_export.e_path)) + dump_to_cache(f, buf, sizeof(buf), dom, path, NULL); + else if (dump_to_cache(f, buf, sizeof(buf), dom, path, &found->m_export) < 0) { xlog(L_WARNING, "Cannot export %s, possibly unsupported filesystem" " or fsid= required", path);