Thread (5 messages) 5 messages, 3 authors, 2023-10-11

Re: [PATCH] lockd: hold a reference to nlmsvc_serv while stopping thread.

From: NeilBrown <hidden>
Date: 2023-10-10 22:30:27

On Tue, 10 Oct 2023, Chuck Lever III wrote:
quoted
On Oct 9, 2023, at 7:35 PM, NeilBrown [off-list ref] wrote:
We are required to hold a reference to the svc_serv struct while
stopping the last thread, as doing that could otherwise drop the last
reference itself and the svc_serv would be freed while still in use.

lockd doesn't do this.  After startup, the only reference is held by the
running thread.

So change locked to hold a reference on nlmsvc_serv while-ever the
service is active, and only drop it after the last thread has been
stopped.

Note: it doesn't really make sense for threads to hold references to the
svc_serv any more.  The fact threads are included in serv->sv_nrthreads
is sufficient.  Maybe a future patch could address this.

Reported-by: Jeff Layton <jlayton@kernel.org>
Fixes: 68cc388c3238 ("SUNRPC: change how svc threads are asked to exit.")
Signed-off-by: NeilBrown <redacted>
Thanks for the fast response!

Should I squash this into 68cc, or apply it before? I would
like to ensure that bisect works nicely over this series of
commits.
Probably makes sense to put it before.  In that case the patch
description needs re-wording.

And on reflection I think the code should be changed a little so that it
matches similar code in nfsd and nfs4-callback.
So I'll repost.
I'll take the liberty of preserving Jeff's review/test even though I've
changed the code .... I hope that's OK.

NeilBrown
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help