[openib-general] [PATCH 2/2] sdp_conn_put/sdp_conn_hold race condition

Michael S. Tsirkin mst at mellanox.co.il
Wed Jul 6 11:03:32 PDT 2005


Use sdp_conn_put_light in cases when we know there is another
reference on the connection.
Rule: sdp_conn_put should never be called on a locked connection:
since its safe to sdp_conn_unlock, this is not the last reference.

Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>

Index: ulp/sdp/sdp_actv.c
===================================================================
--- ulp/sdp/sdp_actv.c	(revision 2784)
+++ ulp/sdp/sdp_actv.c	(working copy)
@@ -325,7 +325,7 @@ error:
 
 	if (conn->state == SDP_CONN_ST_CLOSED) {
 		conn->cm_id = NULL;
-		sdp_conn_put(conn); /* CM reference */
+		sdp_conn_put_light(conn); /* CM reference */
 
 		return -EPROTO;
 	}
@@ -547,7 +547,7 @@ int sdp_cm_connect(struct sdp_sock *conn
 		/*
 		 * callback dosn't have this socket.
 		 */
-		sdp_conn_put(conn); /* address resolution reference */
+		sdp_conn_put_light(conn); /* address resolution reference */
 
 		return -EDESTADDRREQ;
 	}
Index: ulp/sdp/sdp_event.c
===================================================================
--- ulp/sdp/sdp_event.c	(revision 2784)
+++ ulp/sdp/sdp_event.c	(working copy)
@@ -187,7 +187,7 @@ static void sdp_cm_to_error(struct sdp_s
 {
 	sdp_conn_inet_error(conn, -ECONNRESET);
 	conn->cm_id = NULL;
-	sdp_conn_put(conn);	/* CM reference */
+	sdp_conn_put_light(conn);	/* CM reference */
 }
 /*
  * Connection establishment IB/CM callback functions
@@ -228,7 +228,7 @@ static int sdp_cm_idle(struct ib_cm_id *
 	}
 
 	conn->cm_id = NULL;
-	sdp_conn_put(conn); /* CM reference */
+	sdp_conn_put_light(conn); /* CM reference */
 	return -ENOENT;     /* ensure CM cleans-up identifier. */
 }
 

-- 
MST



More information about the general mailing list