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: 1848 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp577949wrr; Thu, 17 Nov 2022 11:15:43 -0800 (PST) X-Google-Smtp-Source: AA0mqf70UWKwge+MzWezxAVN4IMRuVTqmz3H9AvD/eH3/Xr42jNRbqHXAwCA1Bf0dGrG9rQm7Ouz X-Received: by 2002:a17:906:af94:b0:78d:4012:b60a with SMTP id mj20-20020a170906af9400b0078d4012b60amr3290497ejb.476.1668712543393; Thu, 17 Nov 2022 11:15:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668712543; cv=none; d=google.com; s=arc-20160816; b=mB8KtM0kBeY6NLZCY2hxq6fK41o8Els74MdQFoinYFZLhV93bLQ7N0eiDKSCaL9APr 7JMnFGUoqpJ03K+S/+PSD1LRp9rTYhMrmztSs/5RVwymWoAdFR87zxZLYdJUDl8mqxag nCCWOKOzhB4oGL1Fjx0O8SjYHBUl3UnnJ1XDMbRcB8lmY+eAxm8vMXXRSGs0y2KPUpXk uZyVR/Ur01dFVeqF480nVt73ZrbwciEI6QgRDBzyqBY1zhROnVfXahFPvf26XML02y8U G59PLa9wAx2nunoh51kyce8Q9fSBAMkIHzsHxnjXOhspXGFxyE/srYYsVZO8Kx/zx3VF 7l0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=iy8wrI9YUU4G09mt8ojsIl2ZvPCQgT4g4OXDLKFgA/c=; b=IL5+ak+rdP4WKCet8YN4ba30j8UI5IW4U8KQy+UBFg5Yw+4YYwQ92LhFyyr6/rMWgk O0u1aIq8Qdnemzp2DppBPE872pjRS38si23FcGj8iBIp9B5D44z0ST2mKO6RQyN0mEfP Zf3EIoUbSNjxATi5IwNjC/XtCMMPX7HyatgenBiU6U7u5xAkorjOjt74SbC63Ap1vkgP lrWwXQx1sTJHFgCse4stfFHuroSlPYuchf+8AK5r0scB8DZniV8Wf/+qpixTjA3E/zIf Edq/khgj7llBn07kY8+D96RlPw0pbIsLo+zDxzm76F8cgyjvL75WmnOsfel02fOaE0Qh BX0A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw3-20020a170906478300b0078d0f57b0e2si1137451ejc.412.2022.11.17.11.15.18; Thu, 17 Nov 2022 11:15:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240554AbiKQTMX (ORCPT + 99 others); Thu, 17 Nov 2022 14:12:23 -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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, T_SPF_PERMERROR autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749771924099512200?= X-GMAIL-MSGID: =?utf-8?q?1749771924099512200?= 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(-)