Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp6676758pxv; Thu, 29 Jul 2021 22:43:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzA2q/aZPK1ZBUBJOiwXIBDlGLAskDFreB5iooOROLT3kjHM6Rv5tUY0aEU4oUSsqbuzXC4 X-Received: by 2002:a6b:b44c:: with SMTP id d73mr168576iof.10.1627623816710; Thu, 29 Jul 2021 22:43:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627623816; cv=none; d=google.com; s=arc-20160816; b=LxjgPcL2Z5d5He41SGWVFTvAy8SjG0L/1jEWhu4FPo80hXrdpZPKP5ghKh1QWd8nFu wZdrA47jG2g+V7BQHyX39uhPIpRiDoqgzihScZfiNIMj/DgHJI60CFY32ZFltvFsl7v5 UfRuFkxEPqVrqqMCaghnre96jz/d1Jns/393AVzmUo9aMO712F8VyqujO8mU7tMg5elm lNCSlbkXzi3Mk0NsDVnZYe/rfuHY1UavzBXNO4lxnHf5eKQGUbgghmE/2iYTRIHKJvVt lcdob0p//3AwcTuWOW8rbyVb8bJC+n8J66nGDgf1XwX4QRG3QuwWxtJ4bv0u/3ybQMaL Tugw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:references:in-reply-to:subject :cc:to:from:mime-version:content-transfer-encoding:dkim-signature :dkim-signature; bh=d1vVobsHGIK8tpporn/Uz4BMLNgGBlTdsKnVBQ03gqs=; b=Tx9fEkBg5Jl+izvMheB6nbeyhwQFN2PIgIZld8uvn3CCLhvnT3Qws5vJoixCVWADdE ka3x2j/0Iofu8zlDMKeF182SgMnBdjGXidwWKYY/NYdmAgLQG5WE8TEFkEyAsRF1Cd7g KBwPxxjJbtJQl8P3WpW7NRPfLBXGdDZ4JLUxgt1mPT5Mnww1q5tUx6zcXUf/rfFSK4Lc HFiN/38ZHZs/mwXG0daduPdqIxzCMfHZlEe+6+DjBq/xgHv6StC+TEmEuLshzonJqX3c AziJnhPwcDsTkTPJ9xsEkJ00XWNHZ4mNz0e+FdBKc6ccnn0lUtsD6OFjx3/ZraplNcc5 +kWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=HQ9WxcXf; dkim=neutral (no key) header.i=@suse.de header.b=gGE3Xwk1; 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 a16si649987ilb.149.2021.07.29.22.43.21; Thu, 29 Jul 2021 22:43:36 -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; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=HQ9WxcXf; dkim=neutral (no key) header.i=@suse.de header.b=gGE3Xwk1; 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 S236102AbhG3FnX (ORCPT + 99 others); Fri, 30 Jul 2021 01:43:23 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:51110 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230162AbhG3FnW (ORCPT ); Fri, 30 Jul 2021 01:43:22 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 8ABE422386; Fri, 30 Jul 2021 05:43:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1627623797; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=d1vVobsHGIK8tpporn/Uz4BMLNgGBlTdsKnVBQ03gqs=; b=HQ9WxcXf1I3QtRWo0DA/JPVX6NFfD2oJbJuEJcSectdr3ZnwqIDdC9oEeOlihjiDmgg8X4 k3g2mVmenFcKl5G/m9y+w+o1hAwbX6kSKfE6GPaFqGkGL0CjoH9KCub8hvdiq6uWoOEeUE kxHGYVrxjKmlFCyesEe3o7m7l1qtQLM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1627623797; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=d1vVobsHGIK8tpporn/Uz4BMLNgGBlTdsKnVBQ03gqs=; b=gGE3Xwk1k5wETxoc6G8VAHxtnLUJPCSyeHN5LUSN5oO7SY9m+OnGC7Z1e96alzz3c7sDXH PtEKD3GDBWuimACA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A465513BF9; Fri, 30 Jul 2021 05:43:14 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id rw6aGHKRA2ErfAAAMHmgww (envelope-from ); Fri, 30 Jul 2021 05:43:14 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 From: "NeilBrown" To: "Al Viro" 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. In-reply-to: References: <162742539595.32498.13687924366155737575.stgit@noble.brown>, <162742546556.32498.16708762469227881912.stgit@noble.brown>, Date: Fri, 30 Jul 2021 15:43:11 +1000 Message-id: <162762379181.21659.6770844735701522704@noble.neil.brown.name> Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Fri, 30 Jul 2021, Al Viro wrote: > On Wed, Jul 28, 2021 at 08:37:45AM +1000, NeilBrown wrote: >=20 > > 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 *pat= h_parent, > > .dentry =3D dget(path_parent->dentry)}; > > int err =3D 0; > > =20 > > - err =3D follow_down(&path, 0); > > + err =3D follow_down(&path, LOOKUP_AUTOMOUNT); > > if (err < 0) > > goto out; > > if (path.mnt =3D=3D path_parent->mnt && path.dentry =3D=3D path_parent-= >dentry && > > @@ -73,6 +73,13 @@ nfsd_cross_mnt(struct svc_rqst *rqstp, struct path *pa= th_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 =3D path; > > + goto out; > > + } >=20 > ... 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? >=20 Yes, mount_is_internal needs to same mount_lock protection that lookup_mnt() has. Thanks. I don't think it matter how long the result remains valid. The only realistic transtion is from True to False, but the fact that it *was* True means that it is acceptable for the lookup to have succeeded. i.e. If the mountpoint was moved which a request was being processed it will either cause the same result as if it happened before the request started, or after it finished. Either seems OK. Thanks, NeilBrown