linux/fs/lockd
NeilBrown 3391fc92db sunrpc: allow svc threads to fail initialisation cleanly
If an svc thread needs to perform some initialisation that might fail,
it has no good way to handle the failure.

Before the thread can exit it must call svc_exit_thread(), but that
requires the service mutex to be held.  The thread cannot simply take
the mutex as that could deadlock if there is a concurrent attempt to
shut down all threads (which is unlikely, but not impossible).

nfsd currently call svc_exit_thread() unprotected in the unlikely event
that unshare_fs_struct() fails.

We can clean this up by introducing svc_thread_init_status() by which an
svc thread can report whether initialisation has succeeded.  If it has,
it continues normally into the action loop.  If it has not,
svc_thread_init_status() immediately aborts the thread.
svc_start_kthread() waits for either of these to happen, and calls
svc_exit_thread() (under the mutex) if the thread aborted.

Signed-off-by: NeilBrown <neilb@suse.de>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2024-09-20 19:31:03 -04:00
..
clnt4xdr.c lockd: adapt to breakup of struct file_lock 2024-02-05 13:11:43 +01:00
clntlock.c lockd: adapt to breakup of struct file_lock 2024-02-05 13:11:43 +01:00
clntproc.c lockd: adapt to breakup of struct file_lock 2024-02-05 13:11:43 +01:00
clntxdr.c lockd: adapt to breakup of struct file_lock 2024-02-05 13:11:43 +01:00
host.c lockd: discard nlmsvc_timeout 2024-09-01 10:04:56 -04:00
Makefile lockd: Use *-y instead of *-objs in Makefile 2024-07-08 14:10:03 -04:00
mon.c fs: lockd: avoid possible wrong NULL parameter 2023-08-29 17:45:22 -04:00
netns.h filelock: move file locking definitions to separate header file 2023-01-11 06:52:32 -05:00
procfs.c proc: convert everything to "struct proc_ops" 2020-02-04 03:05:26 +00:00
procfs.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
svc4proc.c lockd: adapt to breakup of struct file_lock 2024-02-05 13:11:43 +01:00
svc.c sunrpc: allow svc threads to fail initialisation cleanly 2024-09-20 19:31:03 -04:00
svclock.c lockd: adapt to breakup of struct file_lock 2024-02-05 13:11:43 +01:00
svcproc.c lockd: adapt to breakup of struct file_lock 2024-02-05 13:11:43 +01:00
svcshare.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
svcsubs.c lockd: adapt to breakup of struct file_lock 2024-02-05 13:11:43 +01:00
svcxdr.h NLM: Fix svcxdr_encode_owner() 2021-09-17 10:35:10 -04:00
trace.c lockd: add some client-side tracepoints 2023-04-26 09:05:00 -04:00
trace.h lockd: add some client-side tracepoints 2023-04-26 09:05:00 -04:00
xdr4.c lockd: adapt to breakup of struct file_lock 2024-02-05 13:11:43 +01:00
xdr.c lockd: adapt to breakup of struct file_lock 2024-02-05 13:11:43 +01:00