Initialize sm global variables in mca_btl_sm_component_open(), because they are destructed in mca_btl_sm_component_close(), and init() function might not be called or fail.
For exammple, mca_btl_sm.knem_fd remained 0, and mca_btl_sm_component_close() ended up doing closing fd 0 which belongs to someone else. fixed by Yossi, reviewed by miked cmr=v1.7.4:reviewer=ompi-rm1.7 This commit was SVN r29875.
Этот коммит содержится в:
родитель
bac67e0d81
Коммит
21be95c9b5
@ -272,6 +272,17 @@ static int mca_btl_sm_component_open(void)
|
||||
OBJ_CONSTRUCT(&mca_btl_sm_component.sm_frags_max, ompi_free_list_t);
|
||||
OBJ_CONSTRUCT(&mca_btl_sm_component.sm_frags_user, ompi_free_list_t);
|
||||
OBJ_CONSTRUCT(&mca_btl_sm_component.pending_send_fl, opal_free_list_t);
|
||||
|
||||
mca_btl_sm_component.sm_seg = NULL;
|
||||
#if OMPI_BTL_SM_HAVE_KNEM
|
||||
mca_btl_sm.knem_fd = -1;
|
||||
mca_btl_sm.knem_status_array = NULL;
|
||||
mca_btl_sm.knem_frag_array = NULL;
|
||||
mca_btl_sm.knem_status_num_used = 0;
|
||||
mca_btl_sm.knem_status_first_avail = 0;
|
||||
mca_btl_sm.knem_status_first_used = 0;
|
||||
#endif
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
@ -295,6 +306,7 @@ static int mca_btl_sm_component_close(void)
|
||||
mca_btl_sm.knem_status_array = NULL;
|
||||
}
|
||||
if (-1 != mca_btl_sm.knem_fd) {
|
||||
printf("closing knem fd=%d\n", mca_btl_sm.knem_fd);
|
||||
close(mca_btl_sm.knem_fd);
|
||||
mca_btl_sm.knem_fd = -1;
|
||||
}
|
||||
@ -786,16 +798,6 @@ mca_btl_sm_component_init(int *num_btls,
|
||||
|
||||
#if OMPI_BTL_SM_HAVE_KNEM
|
||||
if (mca_btl_sm_component.use_knem) {
|
||||
/* Set knem_status_num_used outside the check for use_knem so that
|
||||
we can only have to check one thing (knem_status_num_used) in
|
||||
the progress loop. */
|
||||
mca_btl_sm.knem_fd = -1;
|
||||
mca_btl_sm.knem_status_array = NULL;
|
||||
mca_btl_sm.knem_frag_array = NULL;
|
||||
mca_btl_sm.knem_status_num_used = 0;
|
||||
mca_btl_sm.knem_status_first_avail = 0;
|
||||
mca_btl_sm.knem_status_first_used = 0;
|
||||
|
||||
if (0 != mca_btl_sm_component.use_knem) {
|
||||
/* Open the knem device. Try to print a helpful message if we
|
||||
fail to open it. */
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user