Re: [PATCH 6/6] nfsd: add shrinker to reduce number of slots allocated per session

Chuck Lever
2024-12-11T13:44:36Z

On 12/10/24 10:32 PM, NeilBrown wrote:
> On Wed, 11 Dec 2024, Chuck Lever wrote:
>> On 12/8/24 5:43 PM, NeilBrown wrote:
>>> Add a shrinker which frees unused slots and may ask the clients to use
>>> fewer slots on each session.
>
>>
>> Bisected to this patch. Sometime during the pynfs NFSv4.1 server tests,
>> this list_del corruption splat is triggered:
>
> Thanks.
> This fixes it. Do you want to squash it in, or should I resend?

Resend, thanks!

> Having two places that detach a session from a client seems less than
> ideal. I wonder if I should fix that.
>
> Thanks,
> NeilBrown
>
>
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 311f67418759..3b76cfe44b45 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -2425,8 +2425,12 @@ unhash_client_locked(struct nfs4_client *clp)
> }
> list_del_init(&clp->cl_lru);
> spin_lock(&clp->cl_lock);
> - list_for_each_entry(ses, &clp->cl_sessions, se_perclnt)
> + spin_lock(&nfsd_session_list_lock);
> + list_for_each_entry(ses, &clp->cl_sessions, se_perclnt) {
> list_del_init(&ses->se_hash);
> + list_del_init(&ses->se_all_sessions);
> + }
> + spin_unlock(&nfsd_session_list_lock);
> spin_unlock(&clp->cl_lock);
> }
>
>
> Process Finished

--
Chuck Lever