@@ -269,17 +269,22 @@ static inline int get_dynamic_win_info(uint64_t remote_addr,
269269 uint64_t win_count ;
270270 int insert = -1 ;
271271 int ret ;
272+ int ret_unlock ;
272273
273274 /* We need to lock dyn-lock even if the process has an exclusive lock.
274275 * Remote process protects its window attach/detach operations with a
275276 * dynamic lock */
276277 ret = ompi_osc_ucx_dynamic_lock (module , target );
277278 if (ret != OPAL_SUCCESS ) {
278- ret = OMPI_ERROR ;
279- goto cleanup ;
279+ return OMPI_ERROR ;
280280 }
281281
282282 temp_buf = calloc (remote_state_len , 1 );
283+ if (NULL == temp_buf ) {
284+ ret = OMPI_ERR_OUT_OF_RESOURCE ;
285+ goto cleanup ;
286+ }
287+
283288 ret = opal_common_ucx_wpmem_putget (module -> state_mem , OPAL_COMMON_UCX_GET , target ,
284289 (void * )((intptr_t )temp_buf ),
285290 remote_state_len , remote_state_addr , ep );
@@ -316,17 +321,20 @@ static inline int get_dynamic_win_info(uint64_t remote_addr,
316321 _mem_record_t * mem_rec = NULL ;
317322 ret = opal_tsd_tracked_key_get (& module -> mem -> tls_key , (void * * ) & mem_rec );
318323 if (OPAL_SUCCESS != ret ) {
324+ ret = OMPI_ERROR ;
319325 goto cleanup ;
320326 }
321327
322328 if (mem_rec == NULL ) {
323329 OSC_UCX_GET_DEFAULT_EP (ep , module , target );
324330 ret = opal_common_ucx_tlocal_fetch_spath (module -> mem , target , ep );
325331 if (OPAL_SUCCESS != ret ) {
332+ ret = OMPI_ERROR ;
326333 goto cleanup ;
327334 }
328335 ret = opal_tsd_tracked_key_get (& module -> mem -> tls_key , (void * * ) & mem_rec );
329336 if (OPAL_SUCCESS != ret ) {
337+ ret = OMPI_ERROR ;
330338 goto cleanup ;
331339 }
332340
@@ -361,9 +369,9 @@ static inline int get_dynamic_win_info(uint64_t remote_addr,
361369 free (temp_buf );
362370
363371 /* unlock the dynamic lock */
364- ompi_osc_ucx_dynamic_unlock (module , target );
365-
366- return ret ;
372+ ret_unlock = ompi_osc_ucx_dynamic_unlock (module , target );
373+ /* ignore unlock result in case of error */
374+ return ( OMPI_SUCCESS != ret ) ? ret : ret_unlock ;
367375}
368376
369377static inline
@@ -1615,7 +1623,7 @@ void ompi_osc_ucx_req_completion(void *request) {
16151623 assert (req -> phase != ACC_INIT );
16161624 void * free_addr = NULL ;
16171625 bool release_lock = false;
1618- ptrdiff_t temp_lb , temp_extent ;
1626+ ptrdiff_t temp_extent , temp_lb ;
16191627 const void * origin_addr = req -> origin_addr ;
16201628 int origin_count = req -> origin_count ;
16211629 struct ompi_datatype_t * origin_dt = req -> origin_dt ;
@@ -1786,7 +1794,7 @@ void ompi_osc_ucx_req_completion(void *request) {
17861794 module -> state_mem -> skip_periodic_flush = false;
17871795 }
17881796 }
1797+ assert (module -> ctx -> num_incomplete_req_ops > 0 );
17891798 OSC_UCX_DECREMENT_OUTSTANDING_NB_OPS (module );
17901799 ompi_request_complete (& (ucx_req -> super .super ), true);
1791- assert (module -> ctx -> num_incomplete_req_ops >= 0 );
17921800}
0 commit comments