[ofa-general] [PATCH] uDAPL v2:scm: cleanup orphaned UD CR's when destroying the EP

Davis, Arlin R arlin.r.davis at intel.com
Fri Jun 12 09:40:24 PDT 2009


UD CR objects are kept active because of direct private data references
from CONN events. The cr->socket is closed and marked inactive but the
object remains allocated and queued on the CR resource list. There can
be multiple CR's associated with a given EP and there is no way to
determine when consumer is finished with event until the dat_ep_free.
Schedule destruction for all CR's associated with this EP during
free call. cr_thread will complete cleanup with state of SCM_DESTROY.

Signed-off-by: Arlin Davis <arlin.r.davis at intel.com>
---
 dapl/openib_scm/dapl_ib_qp.c |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/dapl/openib_scm/dapl_ib_qp.c b/dapl/openib_scm/dapl_ib_qp.c
index e14d4d9..f30da11 100644
--- a/dapl/openib_scm/dapl_ib_qp.c
+++ b/dapl/openib_scm/dapl_ib_qp.c
@@ -189,6 +189,44 @@ DAT_RETURN dapls_ib_qp_free(IN DAPL_IA * ia_ptr, IN DAPL_EP * ep_ptr)
 		ep_ptr->qp_handle = IB_INVALID_HANDLE;
 	}
 
+#ifdef DAT_EXTENSIONS
+{
+	dp_ib_cm_handle_t cr, next_cr;
+
+	/* 
+	 * UD CR objects are kept active because of direct private data references
+	 * from CONN events. The cr->socket is closed and marked inactive but the 
+	 * object remains allocated and queued on the CR resource list. There can
+	 * be multiple CR's associated with a given EP. There is no way to determine 
+	 * when consumer is finished with event until the dat_ep_free.
+	 *
+	 * Schedule destruction for all CR's associated with this EP, cr_thread will
+ 	 * complete the cleanup with state == SCM_DESTROY. 
+	 */ 
+	dapl_os_lock(&ia_ptr->hca_ptr->ib_trans.lock);
+	if (!dapl_llist_is_empty((DAPL_LLIST_HEAD*)
+				  &ia_ptr->hca_ptr->ib_trans.list))
+            next_cr = dapl_llist_peek_head((DAPL_LLIST_HEAD*)
+					    &ia_ptr->hca_ptr->ib_trans.list);
+	else
+	    next_cr = NULL;
+
+	while (next_cr) {
+		cr = next_cr;
+		next_cr = dapl_llist_next_entry((DAPL_LLIST_HEAD*)
+						&ia_ptr->hca_ptr->ib_trans.list,
+						(DAPL_LLIST_ENTRY*)&cr->entry);
+		if (cr->ep == ep_ptr)  {
+			dapl_dbg_log(DAPL_DBG_TYPE_EP,
+				     " qp_free CR: ep %p cr %p\n", ep_ptr, cr);
+			cr->state = SCM_DESTROY;
+		}
+	}
+	dapl_os_unlock(&ia_ptr->hca_ptr->ib_trans.lock);
+	send(ia_ptr->hca_ptr->ib_trans.scm[1], "w", sizeof "w", 0);
+}
+#endif
+
 	return DAT_SUCCESS;
 }
 
-- 
1.5.2.5




More information about the general mailing list