From patchwork Mon Jan 10 18:44:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Weinberger X-Patchwork-Id: 12709048 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 59A70C433F5 for ; Mon, 10 Jan 2022 18:44:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242051AbiAJSoi (ORCPT ); Mon, 10 Jan 2022 13:44:38 -0500 Received: from lithops.sigma-star.at ([195.201.40.130]:34078 "EHLO lithops.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241010AbiAJSoi (ORCPT ); Mon, 10 Jan 2022 13:44:38 -0500 Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 0653A62DA5FD; Mon, 10 Jan 2022 19:44:37 +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 SqfSNtZe19CD; Mon, 10 Jan 2022 19:44:36 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id B4E3B62DA609; Mon, 10 Jan 2022 19:44:36 +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 aUPoyCPwtB1g; Mon, 10 Jan 2022 19:44:36 +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 42DB362DA5FD; Mon, 10 Jan 2022 19:44:36 +0100 (CET) From: Richard Weinberger To: linux-nfs@vger.kernel.org Cc: bfields@fieldses.org, luis.turcitu@appsbroker.com, chris.chilvers@appsbroker.com, david.young@appsbroker.com, daire@dneg.com, david.oberhollenzer@sigma-star.at, david@sigma-star.at, trond.myklebust@hammerspace.com, anna.schumaker@netapp.com, Richard Weinberger Subject: [RFC PATCH 1/3] NFSD: Teach nfsd_mountpoint() auto mounts Date: Mon, 10 Jan 2022 19:44:17 +0100 Message-Id: <20220110184419.27665-2-richard@nod.at> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20220110184419.27665-1-richard@nod.at> References: <20220110184419.27665-1-richard@nod.at> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Currently nfsd_mountpoint() tests for mount points using d_mountpoint(), this works only when a mount point is already uncovered. In our case the mount point is of type auto mount and can be coverted. i.e. ->d_automount() was not called. Using d_managed() nfsd_mountpoint() can test whether a mount point is either already uncovered or can be uncovered later. Signed-off-by: Richard Weinberger --- fs/nfsd/vfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index c99857689e2c..2f3352a99de6 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -160,7 +160,7 @@ int nfsd_mountpoint(struct dentry *dentry, struct svc_export *exp) return 1; if (nfsd4_is_junction(dentry)) return 1; - if (d_mountpoint(dentry)) + if (d_managed(dentry)) /* * Might only be a mountpoint in a different namespace, * but we need to check. From patchwork Mon Jan 10 18:44:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Weinberger X-Patchwork-Id: 12709049 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 2698DC433EF for ; Mon, 10 Jan 2022 18:44:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241010AbiAJSoj (ORCPT ); Mon, 10 Jan 2022 13:44:39 -0500 Received: from lithops.sigma-star.at ([195.201.40.130]:34114 "EHLO lithops.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242049AbiAJSoj (ORCPT ); Mon, 10 Jan 2022 13:44:39 -0500 Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 8F44E62DA606; Mon, 10 Jan 2022 19:44:37 +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 Y0SjC0SNuVRT; Mon, 10 Jan 2022 19:44:37 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 261EC62DA60B; Mon, 10 Jan 2022 19:44:37 +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 5fzf8hYKB8WV; Mon, 10 Jan 2022 19:44:37 +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 AE19662DA606; Mon, 10 Jan 2022 19:44:36 +0100 (CET) From: Richard Weinberger To: linux-nfs@vger.kernel.org Cc: bfields@fieldses.org, luis.turcitu@appsbroker.com, chris.chilvers@appsbroker.com, david.young@appsbroker.com, daire@dneg.com, david.oberhollenzer@sigma-star.at, david@sigma-star.at, trond.myklebust@hammerspace.com, anna.schumaker@netapp.com, Richard Weinberger Subject: [RFC PATCH 2/3] fs: namei: Allow follow_down() to uncover auto mounts Date: Mon, 10 Jan 2022 19:44:18 +0100 Message-Id: <20220110184419.27665-3-richard@nod.at> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20220110184419.27665-1-richard@nod.at> References: <20220110184419.27665-1-richard@nod.at> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org This function is only used by NFSD to cross mount points. If a mount point is of type auto mount, follow_down() will not uncover it. Add LOOKUP_AUTOMOUNT to the lookup flags to have ->d_automount() called when NFSD walks down the mount tree. Signed-off-by: Richard Weinberger --- fs/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/namei.c b/fs/namei.c index 1f9d2187c765..b9de9fc4bfed 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1410,7 +1410,7 @@ int follow_down(struct path *path) { struct vfsmount *mnt = path->mnt; bool jumped; - int ret = traverse_mounts(path, &jumped, NULL, 0); + int ret = traverse_mounts(path, &jumped, NULL, LOOKUP_AUTOMOUNT); if (path->mnt != mnt) mntput(mnt); From patchwork Mon Jan 10 18:44:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Weinberger X-Patchwork-Id: 12709050 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 45EAEC433FE for ; Mon, 10 Jan 2022 18:44:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242049AbiAJSoj (ORCPT ); Mon, 10 Jan 2022 13:44:39 -0500 Received: from lithops.sigma-star.at ([195.201.40.130]:34132 "EHLO lithops.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239534AbiAJSoj (ORCPT ); Mon, 10 Jan 2022 13:44:39 -0500 Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id F072E62DA609; Mon, 10 Jan 2022 19:44:37 +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 n48sH9chEAtN; Mon, 10 Jan 2022 19:44:37 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 952CC60CEF32; Mon, 10 Jan 2022 19:44:37 +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 KQ1hl9k3Y_wg; Mon, 10 Jan 2022 19:44:37 +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 21A3262DA609; Mon, 10 Jan 2022 19:44:37 +0100 (CET) From: Richard Weinberger To: linux-nfs@vger.kernel.org Cc: bfields@fieldses.org, luis.turcitu@appsbroker.com, chris.chilvers@appsbroker.com, david.young@appsbroker.com, daire@dneg.com, david.oberhollenzer@sigma-star.at, david@sigma-star.at, trond.myklebust@hammerspace.com, anna.schumaker@netapp.com, Richard Weinberger Subject: [RFC PATCH 3/3] NFS: nfs_encode_fh: Remove S_AUTOMOUNT check Date: Mon, 10 Jan 2022 19:44:19 +0100 Message-Id: <20220110184419.27665-4-richard@nod.at> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20220110184419.27665-1-richard@nod.at> References: <20220110184419.27665-1-richard@nod.at> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Now with NFSD being able to cross into auto mounts, the check can be removed. Signed-off-by: Richard Weinberger --- fs/nfs/export.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/fs/nfs/export.c b/fs/nfs/export.c index 8c8028959863..6d56a52c424a 100644 --- a/fs/nfs/export.c +++ b/fs/nfs/export.c @@ -54,11 +54,6 @@ nfs_encode_fh(struct inode *inode, __u32 *p, int *max_len, struct inode *parent) dprintk("%s: max fh len %d inode %p parent %p", __func__, *max_len, inode, parent); - if (IS_AUTOMOUNT(inode)) { - dprintk("%s: refusing to create fh for automount inode %p\n", - __func__, inode); - return FILEID_INVALID; - } if (*max_len < len) { dprintk("%s: fh len %d too small, required %d\n", __func__, *max_len, len);