Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp6534110pxv; Thu, 29 Jul 2021 17:42:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw75eVOZCXpM2dtuEgkyVffcAj3S2SGceKLWQdivXB1xDbimU9RoNfH8GlLesqh78b8s/og X-Received: by 2002:a5e:8519:: with SMTP id i25mr49605ioj.152.1627605767447; Thu, 29 Jul 2021 17:42:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627605767; cv=none; d=google.com; s=arc-20160816; b=VUWqm9saqre0WzEthXKE1Dyfi7pOD/2+fSS8kdA90lSqGULZPb78O/vPQWdZNwXM6V SrSealMxyiXanCz0ke9W9CvJsWEvHnUMTCX1gKBSarcEOLaWTAvpwXMHdwA+m1RD5lTH 5IW6yxeGeewTB3zMI5pgUyjWD5cifkXZ/SkC5dKQkz6FiUjLll/cMB3RYgaxGoO94VIn 5Rzdf+AjA7PywrJxAKzCQYXxUFGXyAMDrI5laG6xhGyq/fw7w6bNyKv6inubxW+EUUcK 9H53FzuErDlTNEprGJwY+44+ypLwA3Lw3HW83XF5tXQoyrfhvG4T8I89aAaPAvL4AxqA rXsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=RnZBQS5ekzOwOY5XQCKJ43gYNg8x/z5Tk3oojKlpwrc=; b=PcBCn35bnKS1yulhtXe3PhDd+Ygz/l86EVA+DP2IihA1J6/9IAEqzvSgLHmhDpJ6sv dipAIar8ptRtt2kUsR5PRP64Y5Rhlc4qTrXAlRMZTOYYEilgHrdNEmM5/w9yYOiW90LZ Lmof21tRN+EPT1vzzswn2AjveR8FcV6SfvnP0AUZQkBjQXzB6a1Vlxj+8Ac+knmTdiL+ HQaUVlDz6Z1Zv2WPuCwYFlGZG7aOBAHQCKwmHIK+vaQXWdCSLtFnLINmtix6ZfaVuH0E IwUrx9+oEYTQfeHWRSWcjqVggT3YlTrOucm1r7g6ZaqRbZqfRnVJCxJzMvsjzuwh4BBs As/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s8si5751477ilu.146.2021.07.29.17.42.31; Thu, 29 Jul 2021 17:42:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231841AbhG3AmU (ORCPT + 99 others); Thu, 29 Jul 2021 20:42:20 -0400 Received: from zeniv-ca.linux.org.uk ([142.44.231.140]:42876 "EHLO zeniv-ca.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229953AbhG3AmR (ORCPT ); Thu, 29 Jul 2021 20:42:17 -0400 Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m9GbC-005366-IM; Fri, 30 Jul 2021 00:42:02 +0000 Date: Fri, 30 Jul 2021 00:42:02 +0000 From: Al Viro To: NeilBrown Cc: Christoph Hellwig , Josef Bacik , "J. Bruce Fields" , Chuck Lever , Chris Mason , David Sterba , linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: Re: [PATCH 09/11] nfsd: Allow filehandle lookup to cross internal mount points. Message-ID: References: <162742539595.32498.13687924366155737575.stgit@noble.brown> <162742546556.32498.16708762469227881912.stgit@noble.brown> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <162742546556.32498.16708762469227881912.stgit@noble.brown> Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Wed, Jul 28, 2021 at 08:37:45AM +1000, NeilBrown wrote: > diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c > index baa12ac36ece..22523e1cd478 100644 > --- a/fs/nfsd/vfs.c > +++ b/fs/nfsd/vfs.c > @@ -64,7 +64,7 @@ nfsd_cross_mnt(struct svc_rqst *rqstp, struct path *path_parent, > .dentry = dget(path_parent->dentry)}; > int err = 0; > > - err = follow_down(&path, 0); > + err = follow_down(&path, LOOKUP_AUTOMOUNT); > if (err < 0) > goto out; > if (path.mnt == path_parent->mnt && path.dentry == path_parent->dentry && > @@ -73,6 +73,13 @@ nfsd_cross_mnt(struct svc_rqst *rqstp, struct path *path_parent, > path_put(&path); > goto out; > } > + if (mount_is_internal(path.mnt)) { > + /* Use the new path, but don't look for a new export */ > + /* FIXME should I check NOHIDE in this case?? */ > + path_put(path_parent); > + *path_parent = path; > + goto out; > + } ... IOW, mount_is_internal() is called with no exclusion whatsoever. What's there to * keep its return value valid? * prevent fetching ->mnt_mountpoint, getting preempted away, having the mount moved *and* what used to be ->mnt_mountpoint evicted from dcache, now that it's no longer pinned, then mount_is_internal() regaining CPU and dereferencing ->mnt_mountpoint, which now points to hell knows what?