[PATCH 0/8] nfsd: reduce the scope of the nfsd_mutex

Jeff Layton posted 8 patches 3 days, 2 hours ago
There is a newer version of this series
fs/nfsd/export.c                                   |  22 +-
fs/nfsd/filecache.c                                |  36 +-
fs/nfsd/netns.h                                    |  16 +
fs/nfsd/nfs4proc.c                                 |   4 +-
fs/nfsd/nfs4state.c                                |   8 +-
fs/nfsd/nfsctl.c                                   | 129 ++---
fs/nfsd/nfsd.h                                     |   4 +-
fs/nfsd/nfssvc.c                                   | 146 ++++--
tools/testing/selftests/nfsd/Makefile              |   2 +
tools/testing/selftests/nfsd/config                |   6 +
tools/testing/selftests/nfsd/nfsd_netlink.h        | 319 ++++++++++++
.../testing/selftests/nfsd/nfsd_netlink_listener.c | 301 +----------
tools/testing/selftests/nfsd/nfsd_netns_isolation  | Bin 0 -> 49192 bytes
.../testing/selftests/nfsd/nfsd_netns_isolation.c  | 450 ++++++++++++++++
tools/testing/selftests/nfsd/nfsd_netns_stress     | Bin 0 -> 39232 bytes
tools/testing/selftests/nfsd/nfsd_netns_stress.c   | 572 +++++++++++++++++++++
tools/testing/selftests/nfsd/settings              |   2 +-
17 files changed, 1580 insertions(+), 437 deletions(-)
[PATCH 0/8] nfsd: reduce the scope of the nfsd_mutex
Posted by Jeff Layton 3 days, 2 hours ago
Currently much of nfsd's administration is serialized under the global
nfsd_mutex, even though most of the objects managed under it are
segregated by net namespace.

This patchset does a couple of small cleanups and then adds a new
per-net mutex and moves all of the appropriate per-net data structures
to be protected by it instead of the global mutex. The filecache is
given its own mutex, and the global mutex is renamed and left for
managing just the few remaning global objects.

I also had an LLM cook up some selftests so we can hopefully keep all of
this working properly in the future.

Please consider for v7.4.

Thanks,
Jeff

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
Jeff Layton (8):
      nfsd: clear NFSD_NET_UP before dropping the generic resource reference
      nfsd: make max_blksize a per-namespace setting
      nfsd: move the control plane to a per-namespace mutex
      nfsd: rename nfsd_mutex to nfsd_global_mutex
      nfsd: give the open file cache its own mutex
      selftests/nfsd: factor the netlink plumbing into a shared header
      selftests/nfsd: add cross-namespace isolation tests
      selftests/nfsd: add a cross-namespace control-plane soak

 fs/nfsd/export.c                                   |  22 +-
 fs/nfsd/filecache.c                                |  36 +-
 fs/nfsd/netns.h                                    |  16 +
 fs/nfsd/nfs4proc.c                                 |   4 +-
 fs/nfsd/nfs4state.c                                |   8 +-
 fs/nfsd/nfsctl.c                                   | 129 ++---
 fs/nfsd/nfsd.h                                     |   4 +-
 fs/nfsd/nfssvc.c                                   | 146 ++++--
 tools/testing/selftests/nfsd/Makefile              |   2 +
 tools/testing/selftests/nfsd/config                |   6 +
 tools/testing/selftests/nfsd/nfsd_netlink.h        | 319 ++++++++++++
 .../testing/selftests/nfsd/nfsd_netlink_listener.c | 301 +----------
 tools/testing/selftests/nfsd/nfsd_netns_isolation  | Bin 0 -> 49192 bytes
 .../testing/selftests/nfsd/nfsd_netns_isolation.c  | 450 ++++++++++++++++
 tools/testing/selftests/nfsd/nfsd_netns_stress     | Bin 0 -> 39232 bytes
 tools/testing/selftests/nfsd/nfsd_netns_stress.c   | 572 +++++++++++++++++++++
 tools/testing/selftests/nfsd/settings              |   2 +-
 17 files changed, 1580 insertions(+), 437 deletions(-)
---
base-commit: aeaddc6a3711283c09a9183068897d4fe1fb464f
change-id: 20260918-nfsd-per-net-mutex-8655764940ac

Best regards,
-- 
Jeff Layton <jlayton@kernel.org>
Re: [PATCH 0/8] nfsd: reduce the scope of the nfsd_mutex
Posted by NeilBrown 2 days, 12 hours ago
On Tue, 22 Sep 2026, Jeff Layton wrote:
> Currently much of nfsd's administration is serialized under the global
> nfsd_mutex, even though most of the objects managed under it are
> segregated by net namespace.
> 
> This patchset does a couple of small cleanups and then adds a new
> per-net mutex and moves all of the appropriate per-net data structures
> to be protected by it instead of the global mutex. The filecache is
> given its own mutex, and the global mutex is renamed and left for
> managing just the few remaning global objects.
> 
> I also had an LLM cook up some selftests so we can hopefully keep all of
> this working properly in the future.
> 
> Please consider for v7.4.

Thanks for doing this Jeff - it is long past time :-)

It all looks good to me - except the selftests which I didn't look at.

Thanks,
NeilBrown



> 
> Thanks,
> Jeff
> 
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
> Jeff Layton (8):
>       nfsd: clear NFSD_NET_UP before dropping the generic resource reference
>       nfsd: make max_blksize a per-namespace setting
>       nfsd: move the control plane to a per-namespace mutex
>       nfsd: rename nfsd_mutex to nfsd_global_mutex
>       nfsd: give the open file cache its own mutex
>       selftests/nfsd: factor the netlink plumbing into a shared header
>       selftests/nfsd: add cross-namespace isolation tests
>       selftests/nfsd: add a cross-namespace control-plane soak
> 
>  fs/nfsd/export.c                                   |  22 +-
>  fs/nfsd/filecache.c                                |  36 +-
>  fs/nfsd/netns.h                                    |  16 +
>  fs/nfsd/nfs4proc.c                                 |   4 +-
>  fs/nfsd/nfs4state.c                                |   8 +-
>  fs/nfsd/nfsctl.c                                   | 129 ++---
>  fs/nfsd/nfsd.h                                     |   4 +-
>  fs/nfsd/nfssvc.c                                   | 146 ++++--
>  tools/testing/selftests/nfsd/Makefile              |   2 +
>  tools/testing/selftests/nfsd/config                |   6 +
>  tools/testing/selftests/nfsd/nfsd_netlink.h        | 319 ++++++++++++
>  .../testing/selftests/nfsd/nfsd_netlink_listener.c | 301 +----------
>  tools/testing/selftests/nfsd/nfsd_netns_isolation  | Bin 0 -> 49192 bytes
>  .../testing/selftests/nfsd/nfsd_netns_isolation.c  | 450 ++++++++++++++++
>  tools/testing/selftests/nfsd/nfsd_netns_stress     | Bin 0 -> 39232 bytes
>  tools/testing/selftests/nfsd/nfsd_netns_stress.c   | 572 +++++++++++++++++++++
>  tools/testing/selftests/nfsd/settings              |   2 +-
>  17 files changed, 1580 insertions(+), 437 deletions(-)
> ---
> base-commit: aeaddc6a3711283c09a9183068897d4fe1fb464f
> change-id: 20260918-nfsd-per-net-mutex-8655764940ac
> 
> Best regards,
> -- 
> Jeff Layton <jlayton@kernel.org>
> 
>