mbox series

[v2,0/2] limit the number of v4 clients to 1024 per 1GB of system memory

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

Message

Dai Ngo July 14, 2022, 4:17 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.

---

Dai Ngo (2):
      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 | 28 ++++++++++++++++++++--------
 fs/nfsd/nfsctl.c    |  8 ++++++++
 fs/nfsd/nfsd.h      |  2 ++
 4 files changed, 33 insertions(+), 8 deletions(-)
--
Dai Ngo

Comments

Chuck Lever July 14, 2022, 5:18 p.m. UTC | #1
> On Jul 14, 2022, at 12:17 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.

Hello Dai, I applied these two to NFSD's for-next branch for early
adopters and other testing and review.


> ---
> 
> Dai Ngo (2):
>      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 | 28 ++++++++++++++++++++--------
> fs/nfsd/nfsctl.c    |  8 ++++++++
> fs/nfsd/nfsd.h      |  2 ++
> 4 files changed, 33 insertions(+), 8 deletions(-)
> --
> Dai Ngo
> 

--
Chuck Lever
Dai Ngo July 14, 2022, 5:56 p.m. UTC | #2
On 7/14/22 10:18 AM, Chuck Lever III wrote:
>
>> On Jul 14, 2022, at 12:17 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.
> Hello Dai, I applied these two to NFSD's for-next branch for early
> adopters and other testing and review.

Thank you Chuck,

-Dai

>
>
>> ---
>>
>> Dai Ngo (2):
>>       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 | 28 ++++++++++++++++++++--------
>> fs/nfsd/nfsctl.c    |  8 ++++++++
>> fs/nfsd/nfsd.h      |  2 ++
>> 4 files changed, 33 insertions(+), 8 deletions(-)
>> --
>> Dai Ngo
>>
> --
> Chuck Lever
>
>
>
Dai Ngo July 14, 2022, 6:14 p.m. UTC | #3
On 7/14/22 10:56 AM, dai.ngo@oracle.com wrote:
>
> On 7/14/22 10:18 AM, Chuck Lever III wrote:
>>
>>> On Jul 14, 2022, at 12:17 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.
>> Hello Dai, I applied these two to NFSD's for-next branch for early
>> adopters and other testing and review.
>
> Thank you Chuck,

I forgot to mention that I will prepare the patches for
pynfs to deal with NFS4ERR_DELAY on SETCLIENIID and
EXCHANGE_ID.

-Dai

>
> -Dai
>
>>
>>
>>> ---
>>>
>>> Dai Ngo (2):
>>>       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 | 28 ++++++++++++++++++++--------
>>> fs/nfsd/nfsctl.c    |  8 ++++++++
>>> fs/nfsd/nfsd.h      |  2 ++
>>> 4 files changed, 33 insertions(+), 8 deletions(-)
>>> -- 
>>> Dai Ngo
>>>
>> -- 
>> Chuck Lever
>>
>>
>>