1
1

Add comments about order of close ops

Per suggestion of @awlauria, added some comments about
the need to free ep before resources it points to.

Signed-off-by: Harumi Kuno <harumi.kuno@hpe.com>
(cherry picked from commit 1bc3dab118bb694d932ef365a7a922e514f82a20)
Signed-off-by: Brian Barrett <bbarrett@amazon.com>
Этот коммит содержится в:
Harumi Kuno 2020-03-07 14:08:39 -07:00 коммит произвёл Brian Barrett
родитель bb57080c84
Коммит faaaf5ca1c
2 изменённых файлов: 5 добавлений и 1 удалений

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

@ -578,6 +578,7 @@ 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);
}
@ -589,10 +590,12 @@ fail:
}
free(module->contexts);
/* 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);
}

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

@ -281,7 +281,7 @@ int mca_btl_ofi_finalize (mca_btl_base_module_t* btl)
ofi_btl->rcache = NULL;
}
/* For a standard ep, we need to close the ep first. */
/* 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;
@ -297,6 +297,7 @@ int mca_btl_ofi_finalize (mca_btl_base_module_t* btl)
fi_close(&ofi_btl->ofi_endpoint->fid);
}
/* close ep before closing av */
if (NULL != ofi_btl->av) {
fi_close(&ofi_btl->av->fid);
}