diff --git a/ompi/mca/btl/usnic/btl_usnic_cclient.c b/ompi/mca/btl/usnic/btl_usnic_cclient.c index 0b52f83e40..9120328690 100644 --- a/ompi/mca/btl/usnic/btl_usnic_cclient.c +++ b/ompi/mca/btl/usnic/btl_usnic_cclient.c @@ -62,6 +62,7 @@ static void client_rml_receive(int status, ompi_process_name_t* sender, UNPACK_UINT32(buffer, cddr->udp_port); /* Tell the main thread that the reply is done */ + opal_atomic_mb(); cddr->receive_done = true; } @@ -150,6 +151,7 @@ int ompi_btl_usnic_connectivity_listen(ompi_btl_usnic_module_t *module) } /* Get the UDP port number that was received */ + opal_atomic_mb(); module->local_addr.connectivity_udp_port = data.udp_port; return OMPI_SUCCESS; diff --git a/ompi/mca/btl/usnic/btl_usnic_connectivity.h b/ompi/mca/btl/usnic/btl_usnic_connectivity.h index a9e3336a9f..d10b1d91cc 100644 --- a/ompi/mca/btl/usnic/btl_usnic_connectivity.h +++ b/ompi/mca/btl/usnic/btl_usnic_connectivity.h @@ -157,11 +157,16 @@ struct ompi_btl_usnic_module_t; * * Note that this macro will call ompi_btl_usnic_util_abort() if an error * occurs. + * + * Also note that we use a temp variable of the correct type because + * some of the values passed in to this macro are volatile, and the + * call to opal_dss.unpack() will discard that volatile qualifier. */ #define UNPACK(buffer, type, opal_unpack_type, value) \ do { \ int ret_value, n = 1; \ type temp; \ + value = (type) 0; \ ret_value = opal_dss.unpack((buffer), &temp, &n, opal_unpack_type); \ if (OPAL_SUCCESS != ret_value) { \ OMPI_ERROR_LOG(ret_value); \