svn commit: r193942 - head/sys/rpc

Rick Macklem rmacklem at FreeBSD.org
Wed Jun 10 19:02:10 UTC 2009


Author: rmacklem
Date: Wed Jun 10 19:02:09 2009
New Revision: 193942
URL: http://svn.freebsd.org/changeset/base/193942

Log:
  For the case where another thread was doing a connect and that
  connect failed, the thread would be left stuck in msleep()
  indefinitely, since it would call msleep() again for the case
  where rc_client == NULL. Change the loop criteria and the if just
  after the loop, so that this case is handled correctly.
  
  Reviewed by:	dfr
  Approved by:	kib (mentor)

Modified:
  head/sys/rpc/clnt_rc.c

Modified: head/sys/rpc/clnt_rc.c
==============================================================================
--- head/sys/rpc/clnt_rc.c	Wed Jun 10 18:27:15 2009	(r193941)
+++ head/sys/rpc/clnt_rc.c	Wed Jun 10 19:02:09 2009	(r193942)
@@ -154,7 +154,7 @@ again:
 		return (RPC_CANTSEND);
 	}
 	if (rc->rc_connecting) {
-		while (!rc->rc_closed && !rc->rc_client) {
+		while (!rc->rc_closed && !rc->rc_client && rc->rc_connecting) {
 			error = msleep(rc, &rc->rc_lock,
 			    rc->rc_intr ? PCATCH : 0, "rpcrecon", 0);
 			if (error) {
@@ -166,7 +166,7 @@ again:
 		 * If the other guy failed to connect, we might as
 		 * well have another go.
 		 */
-		if (!rc->rc_client && !rc->rc_connecting)
+		if (!rc->rc_client || rc->rc_closed)
 			goto again;
 		mtx_unlock(&rc->rc_lock);
 		return (RPC_SUCCESS);


More information about the svn-src-all mailing list