From: Arlin Davis Date: Wed, 10 Jun 2009 16:09:56 +0000 (-0700) Subject: scm: cleanup orphaned UD CR's when destroying the EP X-Git-Tag: dapl-2.0.20-1~5 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=3c26870e276a934e2009090e0fca8bdc36c1be67;p=~ardavis%2Fdapl.git scm: cleanup orphaned UD CR's when destroying the EP 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 --- 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; }