[openib-general] Re: SPAM: [PATCH] [RFC] - dapl - dat_ep_free() can return without freeing the endpoint

Sean Hefty mshefty at ichips.intel.com
Tue Apr 4 15:05:47 PDT 2006


James Lentini wrote:
>> void dapli_destroy_conn(struct dapl_cm_id *conn)
>> {
>> 	int in_callback;
>>+	struct rdma_cm_id *cm_id;
>> 
>> 	dapl_dbg_log(DAPL_DBG_TYPE_CM, 
>> 		     " destroy_conn: conn %p id %d\n",
>> 		     conn,conn->cm_id);
>>-
>> 	dapl_os_lock(&conn->lock);
>> 	conn->destroy = 1;
>> 	in_callback = conn->in_callback;
>>-	dapl_os_unlock(&conn->lock);
>>-
>>-	if (!in_callback) {
>>-		if (conn->ep)
>>-			conn->ep->cm_handle = IB_INVALID_HANDLE;
>>-		if (conn->cm_id) {
>>-			if (conn->cm_id->qp)
>>-				rdma_destroy_qp(conn->cm_id);
>>-			rdma_destroy_id(conn->cm_id);
>>+	do {
>>+		if (in_callback) {
>>+			dapl_os_unlock(&conn->lock);
>>+			usleep(10);
>>+			dapl_os_lock(&conn->lock);

In general this doesn't work.  The calling thread may be the callback thread, 
which would lead to deadlock.  This is why we don't just call rdma_destroy_id() 
directly, and let it wait for the callback to complete.

- Sean




More information about the general mailing list