1
1

Merge pull request #7505 from hkuno/john.l.byrne/btl_ofi

Fix btl ofi clean-up logic
Этот коммит содержится в:
Austen Lauria 2020-03-23 10:10:33 -04:00 коммит произвёл GitHub
родитель 758c3f8d05 ab4875ddc2
Коммит b560fc5fae
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 29 добавлений и 13 удалений

Просмотреть файл

@ -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;