mbox series

[v3,0/3] NFSD: limit the number of v4 clients to 1024 per 1GB of system memory

Message ID 1657929293-30442-1-git-send-email-dai.ngo@oracle.com (mailing list archive)
Headers show
Series NFSD: limit the number of v4 clients to 1024 per 1GB of system memory | expand

Message

Dai Ngo July 15, 2022, 11:54 p.m. UTC
This patch series enforces a limit on the number of v4 clients allowed
in the system. With Courteous server support there are potentially a
lots courtesy clients exist in the system that use up memory resource
preventing them to be used by other components in the system. Also
without a limit on the number of clients, the number of clients can
grow to a very large number even for system with small memory configuration
eventually render the system into an unusable state.

v2:
. move all defines to nfsd.h
. replace unsigned int nfs4_max_client to int
. kick start laundromat in alloc_client when max client reached.
. restyle compute of maxreap in nfs4_get_client_reaplist to oneline.
. redo enforce of maxreap in nfs4_get_client_reaplist for readability
. use bit-wise interger to compute usable memory in nfsd_init_net.
. replace NFS4_MAX_CLIENTS_PER_4GB to NFS4_CLIENTS_PER_GB.
. use all memory, including high mem, to compute max client.

v3:
. refactoring v4 initialization specific code to a helper in nfs4state.c
. fix kernel test robot issue with NFS4_CLIENTS_PER_GB when
  CONFIG_NFSD_V4 is not defined by moving v4 specific code
  to helper nfsd4_init_leases_net in nfs4state.c 

---

Dai Ngo (2):
      NFSD: refactoring v4 specific code to a helper in nfs4state.c
      NFSD: keep track of the number of v4 clients in the system
      NFSD: limit the number of v4 clients to 1024 per 1GB of system memory

 fs/nfsd/netns.h     |  3 +++
 fs/nfsd/nfs4state.c | 49 ++++++++++++++++++++++++++++++++++++++++--------
 fs/nfsd/nfsctl.c    |  9 +--------
 fs/nfsd/nfsd.h      |  6 ++++++
 4 files changed, 51 insertions(+), 16 deletions(-)

--
Dai Ngo

Comments

Chuck Lever III July 16, 2022, 4:21 p.m. UTC | #1
> On Jul 15, 2022, at 7:54 PM, Dai Ngo <dai.ngo@oracle.com> wrote:
> 
> This patch series enforces a limit on the number of v4 clients allowed
> in the system. With Courteous server support there are potentially a
> lots courtesy clients exist in the system that use up memory resource
> preventing them to be used by other components in the system. Also
> without a limit on the number of clients, the number of clients can
> grow to a very large number even for system with small memory configuration
> eventually render the system into an unusable state.
> 
> v2:
> . move all defines to nfsd.h
> . replace unsigned int nfs4_max_client to int
> . kick start laundromat in alloc_client when max client reached.
> . restyle compute of maxreap in nfs4_get_client_reaplist to oneline.
> . redo enforce of maxreap in nfs4_get_client_reaplist for readability
> . use bit-wise interger to compute usable memory in nfsd_init_net.
> . replace NFS4_MAX_CLIENTS_PER_4GB to NFS4_CLIENTS_PER_GB.
> . use all memory, including high mem, to compute max client.
> 
> v3:
> . refactoring v4 initialization specific code to a helper in nfs4state.c
> . fix kernel test robot issue with NFS4_CLIENTS_PER_GB when
>  CONFIG_NFSD_V4 is not defined by moving v4 specific code
>  to helper nfsd4_init_leases_net in nfs4state.c 

Hey Dai-

I pulled these and applied them with a couple of cosmetic changes.
I'm going to run some tests over the weekend before pushing them
to for-next.


> ---
> 
> Dai Ngo (2):
>      NFSD: refactoring v4 specific code to a helper in nfs4state.c
>      NFSD: keep track of the number of v4 clients in the system
>      NFSD: limit the number of v4 clients to 1024 per 1GB of system memory
> 
> fs/nfsd/netns.h     |  3 +++
> fs/nfsd/nfs4state.c | 49 ++++++++++++++++++++++++++++++++++++++++--------
> fs/nfsd/nfsctl.c    |  9 +--------
> fs/nfsd/nfsd.h      |  6 ++++++
> 4 files changed, 51 insertions(+), 16 deletions(-)
> 
> --
> Dai Ngo
> 

--
Chuck Lever