Commit 168e4b39d1afb79a7e3ea6c3bb246b4c82c6bdb9
Committed by
Trond Myklebust
1 parent
3d70f8c617
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
SUNRPC: add WARN_ON_ONCE for potential deadlock
rpc_shutdown_client should never be called from a workqueue context. If it is, it could deadlock looping forever trying to kill tasks that are assigned to the same kworker thread (and will never run rpc_exit_task). Signed-off-by: Weston Andros Adamson <dros@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Showing 1 changed file with 7 additions and 0 deletions Side-by-side Diff
net/sunrpc/clnt.c
... | ... | @@ -607,6 +607,13 @@ |
607 | 607 | */ |
608 | 608 | void rpc_shutdown_client(struct rpc_clnt *clnt) |
609 | 609 | { |
610 | + /* | |
611 | + * To avoid deadlock, never call rpc_shutdown_client from a | |
612 | + * workqueue context! | |
613 | + */ | |
614 | + WARN_ON_ONCE(current->flags & PF_WQ_WORKER); | |
615 | + might_sleep(); | |
616 | + | |
610 | 617 | dprintk_rcu("RPC: shutting down %s client for %s\n", |
611 | 618 | clnt->cl_protname, |
612 | 619 | rcu_dereference(clnt->cl_xprt)->servername); |