mbox series

[0/3,v2] NFS: NFSD: Allow crossing mounts when re-exporting

Message ID 20221207084309.8499-1-richard@nod.at (mailing list archive)
Headers show
Series NFS: NFSD: Allow crossing mounts when re-exporting | expand

Message

Richard Weinberger Dec. 7, 2022, 8:43 a.m. UTC
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(-)

Comments

Chuck Lever Dec. 10, 2022, 4:09 p.m. UTC | #1
> 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
Richard Weinberger Dec. 10, 2022, 9:52 p.m. UTC | #2
----- 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
Chuck Lever Dec. 10, 2022, 9:53 p.m. UTC | #3
> 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
Jeffrey Layton Dec. 12, 2022, 5:06 p.m. UTC | #4
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>
Ian Kent Dec. 13, 2022, 9:09 a.m. UTC | #5
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