Commit 168e4b39 authored by Weston Andros Adamson's avatar Weston Andros Adamson Committed by Trond Myklebust

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: default avatarWeston Andros Adamson <dros@netapp.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 3d70f8c6
...@@ -607,6 +607,13 @@ EXPORT_SYMBOL_GPL(rpc_killall_tasks); ...@@ -607,6 +607,13 @@ EXPORT_SYMBOL_GPL(rpc_killall_tasks);
*/ */
void rpc_shutdown_client(struct rpc_clnt *clnt) void rpc_shutdown_client(struct rpc_clnt *clnt)
{ {
/*
* To avoid deadlock, never call rpc_shutdown_client from a
* workqueue context!
*/
WARN_ON_ONCE(current->flags & PF_WQ_WORKER);
might_sleep();
dprintk_rcu("RPC: shutting down %s client for %s\n", dprintk_rcu("RPC: shutting down %s client for %s\n",
clnt->cl_protname, clnt->cl_protname,
rcu_dereference(clnt->cl_xprt)->servername); rcu_dereference(clnt->cl_xprt)->servername);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment