Merge pull request #7505 from hkuno/john.l.byrne/btl_ofi
Fix btl ofi clean-up logic
Этот коммит содержится в:
Коммит
b560fc5fae
@ -581,6 +581,12 @@ static int mca_btl_ofi_init_device(struct fi_info *info)
|
||||
fail:
|
||||
/* clean up */
|
||||
|
||||
/* close basic ep before closing av */
|
||||
if (NULL != ep && !module->is_scalable_ep) {
|
||||
fi_close(&ep->fid);
|
||||
ep = NULL;
|
||||
}
|
||||
|
||||
/* if the contexts have not been initiated, num_contexts should
|
||||
* be zero and we skip this. */
|
||||
for (int i=0; i < module->num_contexts; i++) {
|
||||
@ -588,14 +594,16 @@ fail:
|
||||
}
|
||||
free(module->contexts);
|
||||
|
||||
if (NULL != av) {
|
||||
fi_close(&av->fid);
|
||||
}
|
||||
|
||||
/* check for NULL ep to avoid double-close */
|
||||
if (NULL != ep) {
|
||||
fi_close(&ep->fid);
|
||||
}
|
||||
|
||||
/* close av after closing basic ep */
|
||||
if (NULL != av) {
|
||||
fi_close(&av->fid);
|
||||
}
|
||||
|
||||
if (NULL != domain) {
|
||||
fi_close(&domain->fid);
|
||||
}
|
||||
|
@ -277,20 +277,33 @@ int mca_btl_ofi_finalize (mca_btl_base_module_t* btl)
|
||||
|
||||
assert(btl);
|
||||
|
||||
/* clear the rcache */
|
||||
if (ofi_btl->rcache) {
|
||||
mca_rcache_base_module_destroy (ofi_btl->rcache);
|
||||
ofi_btl->rcache = NULL;
|
||||
}
|
||||
|
||||
/* Close basic ep before closing its attached resources. */
|
||||
if (NULL != ofi_btl->ofi_endpoint && !ofi_btl->is_scalable_ep) {
|
||||
fi_close(&ofi_btl->ofi_endpoint->fid);
|
||||
ofi_btl->ofi_endpoint = NULL;
|
||||
}
|
||||
|
||||
/* loop over all the contexts */
|
||||
for (i=0; i < ofi_btl->num_contexts; i++) {
|
||||
mca_btl_ofi_context_finalize(&ofi_btl->contexts[i], ofi_btl->is_scalable_ep);
|
||||
}
|
||||
free(ofi_btl->contexts);
|
||||
|
||||
if (NULL != ofi_btl->av) {
|
||||
fi_close(&ofi_btl->av->fid);
|
||||
}
|
||||
|
||||
if (NULL != ofi_btl->ofi_endpoint) {
|
||||
fi_close(&ofi_btl->ofi_endpoint->fid);
|
||||
}
|
||||
|
||||
/* close ep before closing av */
|
||||
if (NULL != ofi_btl->av) {
|
||||
fi_close(&ofi_btl->av->fid);
|
||||
}
|
||||
|
||||
if (NULL != ofi_btl->domain) {
|
||||
fi_close(&ofi_btl->domain->fid);
|
||||
}
|
||||
@ -313,11 +326,6 @@ int mca_btl_ofi_finalize (mca_btl_base_module_t* btl)
|
||||
OBJ_DESTRUCT(&ofi_btl->id_to_endpoint);
|
||||
OBJ_DESTRUCT(&ofi_btl->module_lock);
|
||||
|
||||
if (ofi_btl->rcache) {
|
||||
mca_rcache_base_module_destroy (ofi_btl->rcache);
|
||||
ofi_btl->rcache = NULL;
|
||||
}
|
||||
|
||||
free (btl);
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user