[ofa-general] [PATCH] dat 2.0 - scm: disconnect EP before cleaning up orphaned CR's during dat_ep_free
Arlin Davis
arlin.r.davis at intel.com
Tue Jun 16 12:17:36 PDT 2009
There is the possibility of dat_ep_free being called
with RC CR's still in connected state. Call disconnect
on the CR before marking for destroy. Destroy state
change must be serialized via CR lock.
Signed-off-by: Arlin Davis <arlin.r.davis at intel.com>
---
dapl/openib_scm/dapl_ib_cm.c | 3 ++-
dapl/openib_scm/dapl_ib_qp.c | 3 +++
dapl/openib_scm/dapl_ib_util.h | 2 +-
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/dapl/openib_scm/dapl_ib_cm.c b/dapl/openib_scm/dapl_ib_cm.c
index d116c62..6d39a4a 100644
--- a/dapl/openib_scm/dapl_ib_cm.c
+++ b/dapl/openib_scm/dapl_ib_cm.c
@@ -308,8 +308,9 @@ static void dapli_cm_queue(struct ib_cm_handle *cm_ptr)
/*
* ACTIVE/PASSIVE: called from CR thread or consumer via ep_disconnect
+ * or from ep_free
*/
-static DAT_RETURN dapli_socket_disconnect(dp_ib_cm_handle_t cm_ptr)
+DAT_RETURN dapli_socket_disconnect(dp_ib_cm_handle_t cm_ptr)
{
DAPL_EP *ep_ptr = cm_ptr->ep;
DAT_UINT32 disc_data = htonl(0xdead);
diff --git a/dapl/openib_scm/dapl_ib_qp.c b/dapl/openib_scm/dapl_ib_qp.c
index f30da11..7c3c280 100644
--- a/dapl/openib_scm/dapl_ib_qp.c
+++ b/dapl/openib_scm/dapl_ib_qp.c
@@ -219,7 +219,10 @@ DAT_RETURN dapls_ib_qp_free(IN DAPL_IA * ia_ptr, IN DAPL_EP * ep_ptr)
if (cr->ep == ep_ptr) {
dapl_dbg_log(DAPL_DBG_TYPE_EP,
" qp_free CR: ep %p cr %p\n", ep_ptr, cr);
+ dapli_socket_disconnect(cr);
+ dapl_os_lock(&cr->lock);
cr->state = SCM_DESTROY;
+ dapl_os_unlock(&cr->lock);
}
}
dapl_os_unlock(&ia_ptr->hca_ptr->ib_trans.lock);
diff --git a/dapl/openib_scm/dapl_ib_util.h b/dapl/openib_scm/dapl_ib_util.h
index e924572..ef98ab6 100644
--- a/dapl/openib_scm/dapl_ib_util.h
+++ b/dapl/openib_scm/dapl_ib_util.h
@@ -316,7 +316,7 @@ int32_t dapls_ib_release (void);
void cr_thread(void *arg);
int dapli_cq_thread_init(struct dapl_hca *hca_ptr);
void dapli_cq_thread_destroy(struct dapl_hca *hca_ptr);
-
+DAT_RETURN dapli_socket_disconnect(dp_ib_cm_handle_t cm_ptr);
DAT_RETURN
dapls_modify_qp_state ( IN ib_qp_handle_t qp_handle,
--
1.5.2.5
More information about the general
mailing list