linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3 v2] NFS: NFSD: Allow crossing mounts when re-exporting
@ 2022-12-07  8:43 Richard Weinberger
  2022-12-07  8:43 ` [PATCH 1/3] NFSD: Teach nfsd_mountpoint() auto mounts Richard Weinberger
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Richard Weinberger @ 2022-12-07  8:43 UTC (permalink / raw)
  To: linux-nfs
  Cc: linux-kernel, linux-fsdevel, jlayton, chuck.lever, anna,
	trond.myklebust, viro, raven, chris.chilvers, david.young,
	luis.turcitu, david, benmaynard, Richard Weinberger

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/

Changes since v1:
https://lore.kernel.org/linux-nfs/20221117191151.14262-1-richard@nod.at/

- Use LOOKUP_AUTOMOUNT only when NFSEXP_CROSSMOUNT is set (Jeff Layton)

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            | 6 +++---
 fs/nfs/export.c       | 2 +-
 fs/nfsd/vfs.c         | 8 ++++++--
 include/linux/namei.h | 2 +-
 4 files changed, 11 insertions(+), 7 deletions(-)

-- 
2.26.2


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/3] NFSD: Teach nfsd_mountpoint() auto mounts
  2022-12-07  8:43 [PATCH 0/3 v2] NFS: NFSD: Allow crossing mounts when re-exporting Richard Weinberger
@ 2022-12-07  8:43 ` Richard Weinberger
  2022-12-07  8:43 ` [PATCH 2/3] fs: namei: Allow follow_down() to uncover " Richard Weinberger
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 16+ messages in thread
From: Richard Weinberger @ 2022-12-07  8:43 UTC (permalink / raw)
  To: linux-nfs
  Cc: linux-kernel, linux-fsdevel, jlayton, chuck.lever, anna,
	trond.myklebust, viro, raven, chris.chilvers, david.young,
	luis.turcitu, david, benmaynard, Richard Weinberger

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 <richard@nod.at>
---
 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 f650afedd67f..157f0df0e93a 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.
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/3] fs: namei: Allow follow_down() to uncover auto mounts
  2022-12-07  8:43 [PATCH 0/3 v2] NFS: NFSD: Allow crossing mounts when re-exporting Richard Weinberger
  2022-12-07  8:43 ` [PATCH 1/3] NFSD: Teach nfsd_mountpoint() auto mounts Richard Weinberger
@ 2022-12-07  8:43 ` Richard Weinberger
  2022-12-14 15:15   ` [PATCH 2/3] " Chuck Lever III
  2023-01-03 16:15   ` Chuck Lever III
  2022-12-07  8:43 ` [PATCH 3/3] NFS: nfs_encode_fh: Remove S_AUTOMOUNT check Richard Weinberger
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 16+ messages in thread
From: Richard Weinberger @ 2022-12-07  8:43 UTC (permalink / raw)
  To: linux-nfs
  Cc: linux-kernel, linux-fsdevel, jlayton, chuck.lever, anna,
	trond.myklebust, viro, raven, chris.chilvers, david.young,
	luis.turcitu, david, benmaynard, Richard Weinberger

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 <richard@nod.at>
---
 fs/namei.c            | 6 +++---
 fs/nfsd/vfs.c         | 6 +++++-
 include/linux/namei.h | 2 +-
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 578c2110df02..a6bb6863bf0c 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1458,11 +1458,11 @@ EXPORT_SYMBOL(follow_down_one);
  * point, the filesystem owning that dentry may be queried as to whether the
  * caller is permitted to proceed or not.
  */
-int follow_down(struct path *path)
+int follow_down(struct path *path, unsigned int flags)
 {
 	struct vfsmount *mnt = path->mnt;
 	bool jumped;
-	int ret = traverse_mounts(path, &jumped, NULL, 0);
+	int ret = traverse_mounts(path, &jumped, NULL, flags);
 
 	if (path->mnt != mnt)
 		mntput(mnt);
@@ -2864,7 +2864,7 @@ int path_pts(struct path *path)
 
 	path->dentry = child;
 	dput(parent);
-	follow_down(path);
+	follow_down(path, 0);
 	return 0;
 }
 #endif
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 157f0df0e93a..ced04fc2b947 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -63,9 +63,13 @@ nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp,
 	struct dentry *dentry = *dpp;
 	struct path path = {.mnt = mntget(exp->ex_path.mnt),
 			    .dentry = dget(dentry)};
+	unsigned int follow_flags = 0;
 	int err = 0;
 
-	err = follow_down(&path);
+	if (exp->ex_flags & NFSEXP_CROSSMOUNT)
+		follow_flags = LOOKUP_AUTOMOUNT;
+
+	err = follow_down(&path, follow_flags);
 	if (err < 0)
 		goto out;
 	if (path.mnt == exp->ex_path.mnt && path.dentry == dentry &&
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 00fee52df842..6f96db73a70a 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -77,7 +77,7 @@ struct dentry *lookup_one_positive_unlocked(struct user_namespace *mnt_userns,
 					    struct dentry *base, int len);
 
 extern int follow_down_one(struct path *);
-extern int follow_down(struct path *);
+extern int follow_down(struct path *, unsigned int flags);
 extern int follow_up(struct path *);
 
 extern struct dentry *lock_rename(struct dentry *, struct dentry *);
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 3/3] NFS: nfs_encode_fh: Remove S_AUTOMOUNT check
  2022-12-07  8:43 [PATCH 0/3 v2] NFS: NFSD: Allow crossing mounts when re-exporting Richard Weinberger
  2022-12-07  8:43 ` [PATCH 1/3] NFSD: Teach nfsd_mountpoint() auto mounts Richard Weinberger
  2022-12-07  8:43 ` [PATCH 2/3] fs: namei: Allow follow_down() to uncover " Richard Weinberger
@ 2022-12-07  8:43 ` Richard Weinberger
  2022-12-14 15:09   ` Chuck Lever III
  2022-12-10 16:09 ` [PATCH 0/3 v2] NFS: NFSD: Allow crossing mounts when re-exporting Chuck Lever III
  2022-12-12 17:06 ` Jeff Layton
  4 siblings, 1 reply; 16+ messages in thread
From: Richard Weinberger @ 2022-12-07  8:43 UTC (permalink / raw)
  To: linux-nfs
  Cc: linux-kernel, linux-fsdevel, jlayton, chuck.lever, anna,
	trond.myklebust, viro, raven, chris.chilvers, david.young,
	luis.turcitu, david, benmaynard, Richard Weinberger

Now with NFSD being able to cross into auto mounts,
the check can be removed.

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 fs/nfs/export.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfs/export.c b/fs/nfs/export.c
index 01596f2d0a1e..0a5ee1754d50 100644
--- a/fs/nfs/export.c
+++ b/fs/nfs/export.c
@@ -42,7 +42,7 @@ 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 (*max_len < len || IS_AUTOMOUNT(inode)) {
+	if (*max_len < len) {
 		dprintk("%s: fh len %d too small, required %d\n",
 			__func__, *max_len, len);
 		*max_len = len;
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/3 v2] NFS: NFSD: Allow crossing mounts when re-exporting
  2022-12-07  8:43 [PATCH 0/3 v2] NFS: NFSD: Allow crossing mounts when re-exporting Richard Weinberger
                   ` (2 preceding siblings ...)
  2022-12-07  8:43 ` [PATCH 3/3] NFS: nfs_encode_fh: Remove S_AUTOMOUNT check Richard Weinberger
@ 2022-12-10 16:09 ` Chuck Lever III
  2022-12-10 21:52   ` Richard Weinberger
  2022-12-12 17:06 ` Jeff Layton
  4 siblings, 1 reply; 16+ messages in thread
From: Chuck Lever III @ 2022-12-10 16:09 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Linux NFS Mailing List, LKML, linux-fsdevel, Jeff Layton,
	Anna Schumaker, Trond Myklebust, Al Viro, Ian Kent,
	chris.chilvers, david.young, luis.turcitu, david, benmaynard



> On Dec 7, 2022, at 3:43 AM, Richard Weinberger <richard@nod.at> wrote:
> 
> 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/
> 
> Changes since v1:
> https://lore.kernel.org/linux-nfs/20221117191151.14262-1-richard@nod.at/
> 
> - Use LOOKUP_AUTOMOUNT only when NFSEXP_CROSSMOUNT is set (Jeff Layton)
> 
> 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            | 6 +++---
> fs/nfs/export.c       | 2 +-
> fs/nfsd/vfs.c         | 8 ++++++--
> include/linux/namei.h | 2 +-
> 4 files changed, 11 insertions(+), 7 deletions(-)
> 
> -- 
> 2.26.2
> 

This series is a bit late for inclusion in v6.2. The next opportunity
will be v6.3 in a couple of months. I prefer to have a "final" version
of patches by -rc5.

I'm waiting for review comments on v2 of this series.


--
Chuck Lever




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/3 v2] NFS: NFSD: Allow crossing mounts when re-exporting
  2022-12-10 16:09 ` [PATCH 0/3 v2] NFS: NFSD: Allow crossing mounts when re-exporting Chuck Lever III
@ 2022-12-10 21:52   ` Richard Weinberger
  2022-12-10 21:53     ` Chuck Lever III
  0 siblings, 1 reply; 16+ messages in thread
From: Richard Weinberger @ 2022-12-10 21:52 UTC (permalink / raw)
  To: chuck lever
  Cc: linux-nfs, linux-kernel, linux-fsdevel, Jeff Layton, anna,
	trond myklebust, Al Viro, raven, chris chilvers, david young,
	luis turcitu, david, benmaynard

----- Ursprüngliche Mail -----
> Von: "chuck lever" <chuck.lever@oracle.com>
>> 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            | 6 +++---
>> fs/nfs/export.c       | 2 +-
>> fs/nfsd/vfs.c         | 8 ++++++--
>> include/linux/namei.h | 2 +-
>> 4 files changed, 11 insertions(+), 7 deletions(-)
>> 
>> --
>> 2.26.2
>> 
> 
> This series is a bit late for inclusion in v6.2. The next opportunity
> will be v6.3 in a couple of months. I prefer to have a "final" version
> of patches by -rc5.
> 
> I'm waiting for review comments on v2 of this series.

Ok! Do you want me to resend the series in any case by v6.2-rc5 or only
if new comments arise?

Thanks,
//richard

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/3 v2] NFS: NFSD: Allow crossing mounts when re-exporting
  2022-12-10 21:52   ` Richard Weinberger
@ 2022-12-10 21:53     ` Chuck Lever III
  0 siblings, 0 replies; 16+ messages in thread
From: Chuck Lever III @ 2022-12-10 21:53 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Linux NFS Mailing List, linux-kernel, linux-fsdevel, Jeff Layton,
	anna, trond myklebust, Al Viro, raven, chris chilvers,
	david young, luis turcitu, david, benmaynard



> On Dec 10, 2022, at 4:52 PM, Richard Weinberger <richard@nod.at> wrote:
> 
> ----- Ursprüngliche Mail -----
>> Von: "chuck lever" <chuck.lever@oracle.com>
>>> 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            | 6 +++---
>>> fs/nfs/export.c       | 2 +-
>>> fs/nfsd/vfs.c         | 8 ++++++--
>>> include/linux/namei.h | 2 +-
>>> 4 files changed, 11 insertions(+), 7 deletions(-)
>>> 
>>> --
>>> 2.26.2
>>> 
>> 
>> This series is a bit late for inclusion in v6.2. The next opportunity
>> will be v6.3 in a couple of months. I prefer to have a "final" version
>> of patches by -rc5.
>> 
>> I'm waiting for review comments on v2 of this series.
> 
> Ok! Do you want me to resend the series in any case by v6.2-rc5 or only
> if new comments arise?

If v2 garners no new comments, then send a reminder with a URL to this
thread on lore.kernel.org. I will pull the series from there.


--
Chuck Lever




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/3 v2] NFS: NFSD: Allow crossing mounts when re-exporting
  2022-12-07  8:43 [PATCH 0/3 v2] NFS: NFSD: Allow crossing mounts when re-exporting Richard Weinberger
                   ` (3 preceding siblings ...)
  2022-12-10 16:09 ` [PATCH 0/3 v2] NFS: NFSD: Allow crossing mounts when re-exporting Chuck Lever III
@ 2022-12-12 17:06 ` Jeff Layton
  2022-12-13  9:09   ` Ian Kent
  4 siblings, 1 reply; 16+ messages in thread
From: Jeff Layton @ 2022-12-12 17:06 UTC (permalink / raw)
  To: Richard Weinberger, linux-nfs
  Cc: linux-kernel, linux-fsdevel, chuck.lever, anna, trond.myklebust,
	viro, raven, chris.chilvers, david.young, luis.turcitu, david,
	benmaynard

On Wed, 2022-12-07 at 09:43 +0100, Richard Weinberger wrote:
> 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/
> 
> Changes since v1:
> https://lore.kernel.org/linux-nfs/20221117191151.14262-1-richard@nod.at/
> 
> - Use LOOKUP_AUTOMOUNT only when NFSEXP_CROSSMOUNT is set (Jeff Layton)
> 
> 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            | 6 +++---
>  fs/nfs/export.c       | 2 +-
>  fs/nfsd/vfs.c         | 8 ++++++--
>  include/linux/namei.h | 2 +-
>  4 files changed, 11 insertions(+), 7 deletions(-)
> 

This set looks reasonable to me.

Reviewed-by: Jeff Layton <jlayton@kernel.org>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/3 v2] NFS: NFSD: Allow crossing mounts when re-exporting
  2022-12-12 17:06 ` Jeff Layton
@ 2022-12-13  9:09   ` Ian Kent
  0 siblings, 0 replies; 16+ messages in thread
From: Ian Kent @ 2022-12-13  9:09 UTC (permalink / raw)
  To: Jeff Layton, Richard Weinberger, linux-nfs
  Cc: linux-kernel, linux-fsdevel, chuck.lever, anna, trond.myklebust,
	viro, chris.chilvers, david.young, luis.turcitu, david,
	benmaynard

On 13/12/22 01:06, Jeff Layton wrote:
> On Wed, 2022-12-07 at 09:43 +0100, Richard Weinberger wrote:
>> 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/
>>
>> Changes since v1:
>> https://lore.kernel.org/linux-nfs/20221117191151.14262-1-richard@nod.at/
>>
>> - Use LOOKUP_AUTOMOUNT only when NFSEXP_CROSSMOUNT is set (Jeff Layton)
>>
>> 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            | 6 +++---
>>   fs/nfs/export.c       | 2 +-
>>   fs/nfsd/vfs.c         | 8 ++++++--
>>   include/linux/namei.h | 2 +-
>>   4 files changed, 11 insertions(+), 7 deletions(-)
>>
> This set looks reasonable to me.
>
> Reviewed-by: Jeff Layton <jlayton@kernel.org>

Right, looks ok to me too, at least from the POV of that follow_down()

change.


Reviewed-by: Ian Kent <raven@themaw.net>


Ian


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 3/3] NFS: nfs_encode_fh: Remove S_AUTOMOUNT check
  2022-12-07  8:43 ` [PATCH 3/3] NFS: nfs_encode_fh: Remove S_AUTOMOUNT check Richard Weinberger
@ 2022-12-14 15:09   ` Chuck Lever III
  2022-12-14 16:37     ` Anna Schumaker
  0 siblings, 1 reply; 16+ messages in thread
From: Chuck Lever III @ 2022-12-14 15:09 UTC (permalink / raw)
  To: Anna Schumaker, Trond Myklebust
  Cc: Linux NFS Mailing List, LKML, linux-fsdevel, Jeff Layton,
	Al Viro, Ian Kent, chris.chilvers, david.young, luis.turcitu,
	david, benmaynard, Richard Weinberger



> On Dec 7, 2022, at 3:43 AM, Richard Weinberger <richard@nod.at> wrote:
> 
> Now with NFSD being able to cross into auto mounts,
> the check can be removed.
> 
> Signed-off-by: Richard Weinberger <richard@nod.at>
> ---
> fs/nfs/export.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/nfs/export.c b/fs/nfs/export.c
> index 01596f2d0a1e..0a5ee1754d50 100644
> --- a/fs/nfs/export.c
> +++ b/fs/nfs/export.c
> @@ -42,7 +42,7 @@ 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 (*max_len < len || IS_AUTOMOUNT(inode)) {
> +	if (*max_len < len) {
> 		dprintk("%s: fh len %d too small, required %d\n",
> 			__func__, *max_len, len);
> 		*max_len = len;
> -- 
> 2.26.2
> 

I plan to take this through the nfsd tree, thus this one needs
an Ack from the NFS client maintainers.

--
Chuck Lever




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] namei: Allow follow_down() to uncover auto mounts
  2022-12-07  8:43 ` [PATCH 2/3] fs: namei: Allow follow_down() to uncover " Richard Weinberger
@ 2022-12-14 15:15   ` Chuck Lever III
  2023-01-03 16:15   ` Chuck Lever III
  1 sibling, 0 replies; 16+ messages in thread
From: Chuck Lever III @ 2022-12-14 15:15 UTC (permalink / raw)
  To: Al Viro, linux-fsdevel
  Cc: Linux NFS Mailing List, LKML, linux-fsdevel, Jeff Layton,
	Anna Schumaker, Trond Myklebust, Ian Kent, chris.chilvers,
	david.young, luis.turcitu, david, benmaynard, Richard Weinberger



> On Dec 7, 2022, at 3:43 AM, Richard Weinberger <richard@nod.at> wrote:
> 
> 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 <richard@nod.at>
> ---
> fs/namei.c            | 6 +++---
> fs/nfsd/vfs.c         | 6 +++++-
> include/linux/namei.h | 2 +-
> 3 files changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/namei.c b/fs/namei.c
> index 578c2110df02..a6bb6863bf0c 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -1458,11 +1458,11 @@ EXPORT_SYMBOL(follow_down_one);
>  * point, the filesystem owning that dentry may be queried as to whether the
>  * caller is permitted to proceed or not.
>  */
> -int follow_down(struct path *path)
> +int follow_down(struct path *path, unsigned int flags)
> {
> 	struct vfsmount *mnt = path->mnt;
> 	bool jumped;
> -	int ret = traverse_mounts(path, &jumped, NULL, 0);
> +	int ret = traverse_mounts(path, &jumped, NULL, flags);
> 
> 	if (path->mnt != mnt)
> 		mntput(mnt);
> @@ -2864,7 +2864,7 @@ int path_pts(struct path *path)
> 
> 	path->dentry = child;
> 	dput(parent);
> -	follow_down(path);
> +	follow_down(path, 0);
> 	return 0;
> }
> #endif
> diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
> index 157f0df0e93a..ced04fc2b947 100644
> --- a/fs/nfsd/vfs.c
> +++ b/fs/nfsd/vfs.c
> @@ -63,9 +63,13 @@ nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp,
> 	struct dentry *dentry = *dpp;
> 	struct path path = {.mnt = mntget(exp->ex_path.mnt),
> 			    .dentry = dget(dentry)};
> +	unsigned int follow_flags = 0;
> 	int err = 0;
> 
> -	err = follow_down(&path);
> +	if (exp->ex_flags & NFSEXP_CROSSMOUNT)
> +		follow_flags = LOOKUP_AUTOMOUNT;
> +
> +	err = follow_down(&path, follow_flags);
> 	if (err < 0)
> 		goto out;
> 	if (path.mnt == exp->ex_path.mnt && path.dentry == dentry &&
> diff --git a/include/linux/namei.h b/include/linux/namei.h
> index 00fee52df842..6f96db73a70a 100644
> --- a/include/linux/namei.h
> +++ b/include/linux/namei.h
> @@ -77,7 +77,7 @@ struct dentry *lookup_one_positive_unlocked(struct user_namespace *mnt_userns,
> 					    struct dentry *base, int len);
> 
> extern int follow_down_one(struct path *);
> -extern int follow_down(struct path *);
> +extern int follow_down(struct path *, unsigned int flags);
> extern int follow_up(struct path *);
> 
> extern struct dentry *lock_rename(struct dentry *, struct dentry *);
> -- 
> 2.26.2
> 

I plan to take this through the nfsd tree, thus this one needs
an Ack from the VFS maintainer(s).


--
Chuck Lever




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 3/3] NFS: nfs_encode_fh: Remove S_AUTOMOUNT check
  2022-12-14 15:09   ` Chuck Lever III
@ 2022-12-14 16:37     ` Anna Schumaker
  2022-12-14 16:39       ` Chuck Lever III
  0 siblings, 1 reply; 16+ messages in thread
From: Anna Schumaker @ 2022-12-14 16:37 UTC (permalink / raw)
  To: Chuck Lever III
  Cc: Trond Myklebust, Linux NFS Mailing List, LKML, linux-fsdevel,
	Jeff Layton, Al Viro, Ian Kent, chris.chilvers, david.young,
	luis.turcitu, david, benmaynard, Richard Weinberger

On Wed, Dec 14, 2022 at 10:09 AM Chuck Lever III <chuck.lever@oracle.com> wrote:
>
>
>
> > On Dec 7, 2022, at 3:43 AM, Richard Weinberger <richard@nod.at> wrote:
> >
> > Now with NFSD being able to cross into auto mounts,
> > the check can be removed.
> >
> > Signed-off-by: Richard Weinberger <richard@nod.at>
> > ---
> > fs/nfs/export.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/nfs/export.c b/fs/nfs/export.c
> > index 01596f2d0a1e..0a5ee1754d50 100644
> > --- a/fs/nfs/export.c
> > +++ b/fs/nfs/export.c
> > @@ -42,7 +42,7 @@ 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 (*max_len < len || IS_AUTOMOUNT(inode)) {
> > +     if (*max_len < len) {
> >               dprintk("%s: fh len %d too small, required %d\n",
> >                       __func__, *max_len, len);
> >               *max_len = len;
> > --
> > 2.26.2
> >
>
> I plan to take this through the nfsd tree, thus this one needs
> an Ack from the NFS client maintainers.

Acked-by: Anna Schumaker <Anna.Schumaker@Netapp.com>

>
> --
> Chuck Lever
>
>
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 3/3] NFS: nfs_encode_fh: Remove S_AUTOMOUNT check
  2022-12-14 16:37     ` Anna Schumaker
@ 2022-12-14 16:39       ` Chuck Lever III
  0 siblings, 0 replies; 16+ messages in thread
From: Chuck Lever III @ 2022-12-14 16:39 UTC (permalink / raw)
  To: Anna Schumaker
  Cc: Trond Myklebust, Linux NFS Mailing List, LKML, linux-fsdevel,
	Jeff Layton, Al Viro, Ian Kent, chris.chilvers, david.young,
	luis.turcitu, david, benmaynard, Richard Weinberger



> On Dec 14, 2022, at 11:37 AM, Anna Schumaker <anna@kernel.org> wrote:
> 
> On Wed, Dec 14, 2022 at 10:09 AM Chuck Lever III <chuck.lever@oracle.com> wrote:
>> 
>> 
>> 
>>> On Dec 7, 2022, at 3:43 AM, Richard Weinberger <richard@nod.at> wrote:
>>> 
>>> Now with NFSD being able to cross into auto mounts,
>>> the check can be removed.
>>> 
>>> Signed-off-by: Richard Weinberger <richard@nod.at>
>>> ---
>>> fs/nfs/export.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>> 
>>> diff --git a/fs/nfs/export.c b/fs/nfs/export.c
>>> index 01596f2d0a1e..0a5ee1754d50 100644
>>> --- a/fs/nfs/export.c
>>> +++ b/fs/nfs/export.c
>>> @@ -42,7 +42,7 @@ 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 (*max_len < len || IS_AUTOMOUNT(inode)) {
>>> +     if (*max_len < len) {
>>>              dprintk("%s: fh len %d too small, required %d\n",
>>>                      __func__, *max_len, len);
>>>              *max_len = len;
>>> --
>>> 2.26.2
>>> 
>> 
>> I plan to take this through the nfsd tree, thus this one needs
>> an Ack from the NFS client maintainers.
> 
> Acked-by: Anna Schumaker <Anna.Schumaker@Netapp.com>

Thanks!

--
Chuck Lever




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] namei: Allow follow_down() to uncover auto mounts
  2022-12-07  8:43 ` [PATCH 2/3] fs: namei: Allow follow_down() to uncover " Richard Weinberger
  2022-12-14 15:15   ` [PATCH 2/3] " Chuck Lever III
@ 2023-01-03 16:15   ` Chuck Lever III
  2023-01-29 15:42     ` Richard Weinberger
  1 sibling, 1 reply; 16+ messages in thread
From: Chuck Lever III @ 2023-01-03 16:15 UTC (permalink / raw)
  To: Al Viro
  Cc: Linux NFS Mailing List, Richard Weinberger, LKML, linux-fsdevel,
	Jeff Layton, Anna Schumaker, Trond Myklebust, Ian Kent,
	chris.chilvers, david.young, luis.turcitu, david, benmaynard



> On Dec 7, 2022, at 3:43 AM, Richard Weinberger <richard@nod.at> wrote:
> 
> 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 <richard@nod.at>

Hello Al, you are top of the maintainers listed for fs/namei.c.
I'd like to take this series for v6.3 via the nfsd tree. Can
I get your Acked-by: for this one?


> ---
> fs/namei.c            | 6 +++---
> fs/nfsd/vfs.c         | 6 +++++-
> include/linux/namei.h | 2 +-
> 3 files changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/namei.c b/fs/namei.c
> index 578c2110df02..a6bb6863bf0c 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -1458,11 +1458,11 @@ EXPORT_SYMBOL(follow_down_one);
>  * point, the filesystem owning that dentry may be queried as to whether the
>  * caller is permitted to proceed or not.
>  */
> -int follow_down(struct path *path)
> +int follow_down(struct path *path, unsigned int flags)
> {
> 	struct vfsmount *mnt = path->mnt;
> 	bool jumped;
> -	int ret = traverse_mounts(path, &jumped, NULL, 0);
> +	int ret = traverse_mounts(path, &jumped, NULL, flags);
> 
> 	if (path->mnt != mnt)
> 		mntput(mnt);
> @@ -2864,7 +2864,7 @@ int path_pts(struct path *path)
> 
> 	path->dentry = child;
> 	dput(parent);
> -	follow_down(path);
> +	follow_down(path, 0);
> 	return 0;
> }
> #endif
> diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
> index 157f0df0e93a..ced04fc2b947 100644
> --- a/fs/nfsd/vfs.c
> +++ b/fs/nfsd/vfs.c
> @@ -63,9 +63,13 @@ nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp,
> 	struct dentry *dentry = *dpp;
> 	struct path path = {.mnt = mntget(exp->ex_path.mnt),
> 			    .dentry = dget(dentry)};
> +	unsigned int follow_flags = 0;
> 	int err = 0;
> 
> -	err = follow_down(&path);
> +	if (exp->ex_flags & NFSEXP_CROSSMOUNT)
> +		follow_flags = LOOKUP_AUTOMOUNT;
> +
> +	err = follow_down(&path, follow_flags);
> 	if (err < 0)
> 		goto out;
> 	if (path.mnt == exp->ex_path.mnt && path.dentry == dentry &&
> diff --git a/include/linux/namei.h b/include/linux/namei.h
> index 00fee52df842..6f96db73a70a 100644
> --- a/include/linux/namei.h
> +++ b/include/linux/namei.h
> @@ -77,7 +77,7 @@ struct dentry *lookup_one_positive_unlocked(struct user_namespace *mnt_userns,
> 					    struct dentry *base, int len);
> 
> extern int follow_down_one(struct path *);
> -extern int follow_down(struct path *);
> +extern int follow_down(struct path *, unsigned int flags);
> extern int follow_up(struct path *);
> 
> extern struct dentry *lock_rename(struct dentry *, struct dentry *);
> -- 
> 2.26.2
> 

--
Chuck Lever




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] namei: Allow follow_down() to uncover auto mounts
  2023-01-03 16:15   ` Chuck Lever III
@ 2023-01-29 15:42     ` Richard Weinberger
  2023-01-30  2:15       ` Al Viro
  0 siblings, 1 reply; 16+ messages in thread
From: Richard Weinberger @ 2023-01-29 15:42 UTC (permalink / raw)
  To: chuck lever, Al Viro
  Cc: linux-nfs, linux-kernel, linux-fsdevel, Jeff Layton, anna,
	trond myklebust, raven, chris chilvers, david young,
	luis turcitu, david, benmaynard

----- Ursprüngliche Mail -----
> Von: "chuck lever" <chuck.lever@oracle.com>
>> On Dec 7, 2022, at 3:43 AM, Richard Weinberger <richard@nod.at> wrote:
>> 
>> 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 <richard@nod.at>
> 
> Hello Al, you are top of the maintainers listed for fs/namei.c.
> I'd like to take this series for v6.3 via the nfsd tree. Can
> I get your Acked-by: for this one?

ping?

Thanks,
//richard

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] namei: Allow follow_down() to uncover auto mounts
  2023-01-29 15:42     ` Richard Weinberger
@ 2023-01-30  2:15       ` Al Viro
  0 siblings, 0 replies; 16+ messages in thread
From: Al Viro @ 2023-01-30  2:15 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: chuck lever, linux-nfs, linux-kernel, linux-fsdevel, Jeff Layton,
	anna, trond myklebust, raven, chris chilvers, david young,
	luis turcitu, david, benmaynard

On Sun, Jan 29, 2023 at 04:42:39PM +0100, Richard Weinberger wrote:
> ----- Ursprüngliche Mail -----
> > Von: "chuck lever" <chuck.lever@oracle.com>
> >> On Dec 7, 2022, at 3:43 AM, Richard Weinberger <richard@nod.at> wrote:
> >> 
> >> 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 <richard@nod.at>
> > 
> > Hello Al, you are top of the maintainers listed for fs/namei.c.
> > I'd like to take this series for v6.3 via the nfsd tree. Can
> > I get your Acked-by: for this one?
> 
> ping?

modulo clumsy wording ("mount point is of type auto mount")

Acked-by: Al Viro <viro@zeniv.linux.org.uk>

Commit message sounds as if it refered to autofs, rather than NFS referrals
et.al. and AFAICS those are the cases it's really about...

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-01-30  2:16 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-07  8:43 [PATCH 0/3 v2] NFS: NFSD: Allow crossing mounts when re-exporting Richard Weinberger
2022-12-07  8:43 ` [PATCH 1/3] NFSD: Teach nfsd_mountpoint() auto mounts Richard Weinberger
2022-12-07  8:43 ` [PATCH 2/3] fs: namei: Allow follow_down() to uncover " Richard Weinberger
2022-12-14 15:15   ` [PATCH 2/3] " Chuck Lever III
2023-01-03 16:15   ` Chuck Lever III
2023-01-29 15:42     ` Richard Weinberger
2023-01-30  2:15       ` Al Viro
2022-12-07  8:43 ` [PATCH 3/3] NFS: nfs_encode_fh: Remove S_AUTOMOUNT check Richard Weinberger
2022-12-14 15:09   ` Chuck Lever III
2022-12-14 16:37     ` Anna Schumaker
2022-12-14 16:39       ` Chuck Lever III
2022-12-10 16:09 ` [PATCH 0/3 v2] NFS: NFSD: Allow crossing mounts when re-exporting Chuck Lever III
2022-12-10 21:52   ` Richard Weinberger
2022-12-10 21:53     ` Chuck Lever III
2022-12-12 17:06 ` Jeff Layton
2022-12-13  9:09   ` Ian Kent

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).