static int psmx_stx_close(fid_t fid) { struct psmx_fid_stx *stx; stx = container_of(fid, struct psmx_fid_stx, stx.fid); psmx_domain_release(stx->domain); free(stx); return 0; }
static int psmx_mr_close(fid_t fid) { struct psmx_fid_mr *mr; mr = container_of(fid, struct psmx_fid_mr, mr.fid); psmx_mr_release_key(mr->domain, mr->mr.key); psmx_domain_release(mr->domain); free(mr); return 0; }
static int psmx_domain_close(fid_t fid) { struct psmx_fid_domain *domain; int err; domain = container_of(fid, struct psmx_fid_domain, util_domain.domain_fid.fid); FI_INFO(&psmx_prov, FI_LOG_DOMAIN, "refcnt=%d\n", ofi_atomic_get32(&domain->util_domain.ref)); psmx_domain_release(domain); if (ofi_domain_close(&domain->util_domain)) return 0; if (domain->progress_thread_enabled) psmx_domain_stop_progress(domain); if (domain->am_initialized) psmx_am_fini(domain); fastlock_destroy(&domain->poll_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. */ psm_mq_finalize(domain->psm_mq); #endif /* workaround for: * Assertion failure at psm_ep.c:1059: ep->mctxt_master == ep */ sleep(psmx_env.delay); if (psmx_env.timeout) err = psm_ep_close(domain->psm_ep, PSM_EP_CLOSE_GRACEFUL, (int64_t) psmx_env.timeout * 1000000000LL); else err = PSM_EP_CLOSE_TIMEOUT; if (err != PSM_OK) psm_ep_close(domain->psm_ep, PSM_EP_CLOSE_FORCE, 0); domain->fabric->active_domain = NULL; free(domain); return 0; }
static int psmx_av_close(fid_t fid) { struct psmx_fid_av *av; av = container_of(fid, struct psmx_fid_av, av.fid); psmx_domain_release(av->domain); if (av->psm_epids) free(av->psm_epids); if (av->psm_epaddrs) free(av->psm_epaddrs); free(av); return 0; }
static int psmx_cntr_close(fid_t fid) { struct psmx_fid_cntr *cntr; cntr = container_of(fid, struct psmx_fid_cntr, cntr.fid); psmx_domain_release(cntr->domain); if (cntr->wait && cntr->wait_is_local) fi_close((fid_t)cntr->wait); pthread_mutex_destroy(&cntr->trigger_lock); free(cntr); return 0; }
static int psmx_ep_close(fid_t fid) { struct psmx_fid_ep *ep; ep = container_of(fid, struct psmx_fid_ep, ep.fid); if (ep->base_ep) { atomic_dec(&ep->base_ep->ref); return 0; } if (atomic_get(&ep->ref)) return -FI_EBUSY; psmx_ns_del_local_name(ep->service, ep->domain->psm_epid); psmx_domain_disable_ep(ep->domain, ep); psmx_domain_release(ep->domain); free(ep); return 0; }