diff options
author | NeilBrown <neilb@suse.de> | 2024-07-26 13:59:55 +1000 |
---|---|---|
committer | Chuck Lever <chuck.lever@oracle.com> | 2024-09-20 19:31:03 -0400 |
commit | 16ef80eedcd34799db69990e13f69b812d2690f1 (patch) | |
tree | 2b0fec3befda41cca040854ce472ca1237f66642 /net/sunrpc | |
parent | 73598a0cfb21fb21928e638f7f21be6021ac2a16 (diff) |
sunrpc: document locking rules for svc_exit_thread()
The locking required for svc_exit_thread() is not obvious, so document
it in a kdoc comment.
Signed-off-by: NeilBrown <neilb@suse.de>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/svc.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 561d20a5316e..2e148137376d 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -945,6 +945,20 @@ void svc_rqst_release_pages(struct svc_rqst *rqstp) } } +/** + * svc_exit_thread - finalise the termination of a sunrpc server thread + * @rqstp: the svc_rqst which represents the thread. + * + * When a thread started with svc_new_thread() exits it must call + * svc_exit_thread() as its last act. This must be done with the + * service mutex held. Normally this is held by a DIFFERENT thread, the + * one that is calling svc_set_num_threads() and which will wait for + * SP_VICTIM_REMAINS to be cleared before dropping the mutex. If the + * thread exits for any reason other than svc_thread_should_stop() + * returning %true (which indicated that svc_set_num_threads() is + * waiting for it to exit), then it must take the service mutex itself, + * which can only safely be done using mutex_try_lock(). + */ void svc_exit_thread(struct svc_rqst *rqstp) { |