[PATCH] eliminate hangs during RPC client shutdown

From: Chuck Lever (cel@citi.umich.edu)
Date: Thu Aug 22 2002 - 17:15:04 EST


linus-

this is against 2.5.31 with the recent RPC call_start/reserve patches
applied, and eliminates an infinite loop in rpciod if an RPC client's
reference counter accidentally goes negative. i've been running this
under load since 2.5.30 with no ill effects.

diff -drN -U2 06-connect2/net/sunrpc/clnt.c 07-shutdown/net/sunrpc/clnt.c
--- 06-connect2/net/sunrpc/clnt.c Mon Aug 12 16:31:53 2002
+++ 07-shutdown/net/sunrpc/clnt.c Mon Aug 12 16:53:24 2002
@@ -138,11 +138,9 @@
 rpc_shutdown_client(struct rpc_clnt *clnt)
 {
- dprintk("RPC: shutting down %s client for %s\n",
- clnt->cl_protname, clnt->cl_server);
- while (atomic_read(&clnt->cl_users)) {
-#ifdef RPC_DEBUG
- dprintk("RPC: rpc_shutdown_client: client %s, tasks=%d\n",
- clnt->cl_protname, atomic_read(&clnt->cl_users));
-#endif
+ dprintk("RPC: shutting down %s client for %s, tasks=%d\n",
+ clnt->cl_protname, clnt->cl_server,
+ atomic_read(&clnt->cl_users));
+
+ while (atomic_read(&clnt->cl_users) > 0) {
                 /* Don't let rpc_release_client destroy us */
                 clnt->cl_oneshot = 0;
@@ -151,4 +149,14 @@
                 sleep_on_timeout(&destroy_wait, 1*HZ);
         }
+
+ if (atomic_read(&clnt->cl_users) < 0) {
+ printk(KERN_ERR "RPC: rpc_shutdown_client clnt %p tasks=%d\n",
+ clnt, atomic_read(&clnt->cl_users));
+#ifdef RPC_DEBUG
+ rpc_show_tasks();
+#endif
+ BUG();
+ }
+
         return rpc_destroy_client(clnt);
 }

-- 

corporate: <cel at netapp dot com> personal: <chucklever at bigfoot dot com>

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Aug 23 2002 - 22:00:26 EST