1
1

usnic: avoid a possible race condition

Per #4874, code review revealed a possible race condition in the
module struct and the connectivity agent.  Move the setup of the
connectivity agent listener until the module struct has been fully
setup.

This commit was SVN r32573.
Этот коммит содержится в:
Jeff Squyres 2014-08-22 02:34:24 +00:00
родитель a896f90712
Коммит b0dfb9f401

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

@ -2086,19 +2086,6 @@ int opal_btl_usnic_module_init(opal_btl_usnic_module_t *module)
"btl:usnic: not sorting devices by NUMA distance (topology support not included)"); "btl:usnic: not sorting devices by NUMA distance (topology support not included)");
#endif #endif
/* Setup a connectivity listener */
if (mca_btl_usnic_component.connectivity_enabled) {
rc = opal_btl_usnic_connectivity_listen(module);
if (OPAL_SUCCESS != rc) {
OPAL_ERROR_LOG(rc);
ABORT("Failed to notify connectivity agent to listen");
}
} else {
/* If we're not doing a connectivity check, just set the port
to 0 */
module->local_addr.connectivity_udp_port = 0;
}
/* Setup the pointer array for the procs that will be used by this /* Setup the pointer array for the procs that will be used by this
module */ module */
OBJ_CONSTRUCT(&module->all_procs, opal_pointer_array_t); OBJ_CONSTRUCT(&module->all_procs, opal_pointer_array_t);
@ -2288,6 +2275,19 @@ int opal_btl_usnic_module_init(opal_btl_usnic_module_t *module)
/* Initialize stats on this module */ /* Initialize stats on this module */
opal_btl_usnic_stats_init(module); opal_btl_usnic_stats_init(module);
/* Setup a connectivity listener */
if (mca_btl_usnic_component.connectivity_enabled) {
rc = opal_btl_usnic_connectivity_listen(module);
if (OPAL_SUCCESS != rc) {
OPAL_ERROR_LOG(rc);
ABORT("Failed to notify connectivity agent to listen");
}
} else {
/* If we're not doing a connectivity check, just set the port
to 0 */
module->local_addr.connectivity_udp_port = 0;
}
return OPAL_SUCCESS; return OPAL_SUCCESS;
chan_destroy: chan_destroy: