[openib-general] RE: [PATCH] multiple RDMA_CM_EVENT_DISCONNECTED callbacks

Eric Barton eeb at bartonsoftware.com
Tue May 23 09:03:48 PDT 2006


Sean,

I just tested your patch and checked that it prevents the double 
DISCONNECT event callback (it does :).

                Cheers,
                        Eric

---------------------------------------------------
|Eric Barton        Barton Software               |
|9 York Gardens     Tel:    +44 (117) 330 1575    |
|Clifton            Mobile: +44 (7909) 680 356    |
|Bristol BS8 4LL    Fax:    call first            |
|United Kingdom     E-Mail: eeb at bartonsoftware.com|
---------------------------------------------------
 

> -----Original Message-----
> From: Sean Hefty [mailto:sean.hefty at intel.com] 
> Sent: 19 May 2006 9:07 PM
> To: 'Eric Barton'; openib-general at openib.org
> Subject: [PATCH] multiple RDMA_CM_EVENT_DISCONNECTED callbacks
> 
> 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