[openib-general] [PATCH] multiple RDMA_CM_EVENT_DISCONNECTED callbacks

Sean Hefty sean.hefty at intel.com
Fri May 19 13:07:07 PDT 2006


Eric

Can you try this patch and let me know if it fixes your problem?

- Sean
---
Prevent generating duplicated DISCONNECT events.

Signed-off-by: Sean Hefty <sean.hefty at intel.com>
---
Index: cma.c
===================================================================
--- cma.c	(revision 7362)
+++ cma.c	(working copy)
@@ -83,6 +83,7 @@ enum cma_state {
 	CMA_ROUTE_QUERY,
 	CMA_ROUTE_RESOLVED,
 	CMA_CONNECT,
+	CMA_DISCONNECT,
 	CMA_ADDR_BOUND,
 	CMA_LISTEN,
 	CMA_DEVICE_REMOVAL,
@@ -801,6 +802,8 @@ static int cma_ib_handler(struct ib_cm_i
 		status = -ETIMEDOUT; /* fall through */
 	case IB_CM_DREQ_RECEIVED:
 	case IB_CM_DREP_RECEIVED:
+		if (!cma_comp_exch(id_priv, CMA_CONNECT, CMA_DISCONNECT))
+			goto out;
 		event = RDMA_CM_EVENT_DISCONNECTED;
 		break;
 	case IB_CM_TIMEWAIT_EXIT:
@@ -1770,7 +1773,8 @@ int rdma_disconnect(struct rdma_cm_id *i
 	int ret;
 
 	id_priv = container_of(id, struct rdma_id_private, id);
-	if (!cma_comp(id_priv, CMA_CONNECT))
+	if (!cma_comp(id_priv, CMA_CONNECT) &&
+	    !cma_comp(id_priv, CMA_DISCONNECT))
 		return -EINVAL;
 
 	ret = cma_modify_qp_err(id);




More information about the general mailing list