diff options
author | Weston Andros Adamson <dros@netapp.com> | 2012-10-30 17:01:40 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-11-04 14:43:38 -0500 |
commit | 168e4b39d1afb79a7e3ea6c3bb246b4c82c6bdb9 (patch) | |
tree | f5b591952b85baf4ec3a9c7c7e29d0667724eda4 /net | |
parent | 3d70f8c617a436c7146ecb81df2265b4626dfe89 (diff) |
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>
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/clnt.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index cdc7564b4512..dd2532c10324 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -607,6 +607,13 @@ EXPORT_SYMBOL_GPL(rpc_killall_tasks); | |||
607 | */ | 607 | */ |
608 | void rpc_shutdown_client(struct rpc_clnt *clnt) | 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 | dprintk_rcu("RPC: shutting down %s client for %s\n", | 617 | dprintk_rcu("RPC: shutting down %s client for %s\n", |
611 | clnt->cl_protname, | 618 | clnt->cl_protname, |
612 | rcu_dereference(clnt->cl_xprt)->servername); | 619 | rcu_dereference(clnt->cl_xprt)->servername); |