From patchwork Thu Nov 17 19:11:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Weinberger X-Patchwork-Id: 13047212 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 439BBC43219 for ; Thu, 17 Nov 2022 19:12:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240528AbiKQTMS (ORCPT ); Thu, 17 Nov 2022 14:12:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235031AbiKQTMM (ORCPT ); Thu, 17 Nov 2022 14:12:12 -0500 Received: from lithops.sigma-star.at (lithops.sigma-star.at [195.201.40.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61BC087561; Thu, 17 Nov 2022 11:12:10 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 13406605DED7; Thu, 17 Nov 2022 20:12:08 +0100 (CET) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id LJYlS4X-wXkK; Thu, 17 Nov 2022 20:12:07 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 56CDB63E5168; Thu, 17 Nov 2022 20:12:07 +0100 (CET) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id YGGq6Y6GdMPl; Thu, 17 Nov 2022 20:12:07 +0100 (CET) Received: from blindfold.corp.sigma-star.at (213-47-184-186.cable.dynamic.surfer.at [213.47.184.186]) by lithops.sigma-star.at (Postfix) with ESMTPSA id B763963E5146; Thu, 17 Nov 2022 20:12:06 +0100 (CET) From: Richard Weinberger To: linux-nfs@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, jlayton@kernel.org, chuck.lever@oracle.com, anna@kernel.org, trond.myklebust@hammerspace.com, viro@zeniv.linux.org.uk, raven@themaw.net, chris.chilvers@appsbroker.com, david.young@appsbroker.com, luis.turcitu@appsbroker.com, david@sigma-star.at, Richard Weinberger Subject: [PATCH 0/3] NFS: NFSD: Allow crossing mounts when re-exporting Date: Thu, 17 Nov 2022 20:11:48 +0100 Message-Id: <20221117191151.14262-1-richard@nod.at> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Currently when re-exporting a NFS share the NFS cross mount feature does not work [0]. This patch series outlines an approach to address the problem. Crossing mounts does not work for two reasons: 1. As soon the NFS client (on the re-exporting server) sees a different filesystem id, it installs an automount. That way the other filesystem will be mounted automatically when someone enters the directory. But the cross mount logic of KNFS does not know about automount. This patch series addresses the problem and teach both KNFSD and the exportfs logic of NFS to deal with automount. 2. When KNFSD detects crossing of a mount point, it asks rpc.mountd to install a new export for the target mount point. Beside of authentication rpc.mountd also has to find a filesystem id for the new export. Is the to be exported filesystem a NFS share, rpc.mountd cannot derive a filesystem id from it and refuses to export. In the logs you'll see errors such as: mountd: Cannot export /srv/nfs/vol0, possibly unsupported filesystem or fsid= required To deal with that I've changed rpc.mountd to use generate and store fsids [1]. Since the kernel side of my changes did change for a long time I decided to try upstreaming it first. A 3rd iteration of my rpc.mountd will happen soon. [0] https://marc.info/?l=linux-nfs&m=161653016627277&w=2 [1] https://lore.kernel.org/linux-nfs/20220217131531.2890-1-richard@nod.at/ Richard Weinberger (3): NFSD: Teach nfsd_mountpoint() auto mounts fs: namei: Allow follow_down() to uncover auto mounts NFS: nfs_encode_fh: Remove S_AUTOMOUNT check fs/namei.c | 2 +- fs/nfs/export.c | 2 +- fs/nfsd/vfs.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)