void psmx2_trx_ctxt_free(struct psmx2_trx_ctxt *trx_ctxt) { int err; if (!trx_ctxt) return; if (trx_ctxt->am_initialized) psmx2_am_fini(trx_ctxt); #if 0 /* AM messages could arrive after MQ is finalized, causing segfault * when trying to dereference the MQ pointer. There is no mechanism * to properly shutdown AM. The workaround is to keep MQ valid. */ psm2_mq_finalize(trx_ctxt->psm2_mq); #endif /* workaround for: * Assertion failure at psm2_ep.c:1059: ep->mctxt_master == ep */ sleep(psmx2_env.delay); if (psmx2_env.timeout) err = psm2_ep_close(trx_ctxt->psm2_ep, PSM2_EP_CLOSE_GRACEFUL, (int64_t) psmx2_env.timeout * 1000000000LL); else err = PSM2_EP_CLOSE_TIMEOUT; if (err != PSM2_OK) psm2_ep_close(trx_ctxt->psm2_ep, PSM2_EP_CLOSE_FORCE, 0); fastlock_destroy(&trx_ctxt->poll_lock); free(trx_ctxt); }
void psmx2_domain_release(struct psmx2_fid_domain *domain) { int err; FI_INFO(&psmx2_prov, FI_LOG_DOMAIN, "refcnt=%d\n", domain->refcnt); if (--domain->refcnt > 0) return; if (domain->progress_thread_enabled) psmx2_domain_stop_progress(domain); psmx2_am_fini(domain); fastlock_destroy(&domain->poll_lock); fastlock_destroy(&domain->vl_lock); rbtDelete(domain->mr_map); fastlock_destroy(&domain->mr_lock); #if 0 /* AM messages could arrive after MQ is finalized, causing segfault * when trying to dereference the MQ pointer. There is no mechanism * to properly shutdown AM. The workaround is to keep MQ valid. */ psm2_mq_finalize(domain->psm2_mq); #endif /* workaround for: * Assertion failure at psm2_ep.c:1059: ep->mctxt_master == ep */ sleep(psmx2_env.delay); if (psmx2_env.timeout) err = psm2_ep_close(domain->psm2_ep, PSM2_EP_CLOSE_GRACEFUL, (int64_t) psmx2_env.timeout * 1000000000LL); else err = PSM2_EP_CLOSE_TIMEOUT; if (err != PSM2_OK) psm2_ep_close(domain->psm2_ep, PSM2_EP_CLOSE_FORCE, 0); domain->fabric->active_domain = NULL; psmx2_fabric_release(domain->fabric); free(domain); }