Skip to content

Commit 868eee3

Browse files
authored
Merge pull request #7883 from hoopoepg/topic/fixed-potential-deadlock-wpool
UCX/WPOOL: fixed potential deadlock
2 parents 3ed466e + a383312 commit 868eee3

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

opal/mca/common/ucx/common_ucx_wpool.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -376,14 +376,15 @@ opal_common_ucx_wpmem_putget(opal_common_ucx_wpmem_t *mem, opal_common_ucx_op_t
376376
if (OPAL_UNLIKELY(status != UCS_OK && status != UCS_INPROGRESS)) {
377377
MCA_COMMON_UCX_ERROR("%s failed: %d", called_func, status);
378378
rc = OPAL_ERROR;
379+
goto out;
379380
}
380381

381382
rc = _periodical_flush_nb(mem, winfo, target);
382383
if(OPAL_UNLIKELY(OPAL_SUCCESS != rc)){
383384
MCA_COMMON_UCX_VERBOSE(1, "_incr_and_check_inflight_ops failed: %d", rc);
384-
return rc;
385385
}
386386

387+
out:
387388
opal_mutex_unlock(&winfo->mutex);
388389

389390
return rc;
@@ -416,14 +417,15 @@ opal_common_ucx_wpmem_cmpswp(opal_common_ucx_wpmem_t *mem, uint64_t compare,
416417
if (OPAL_UNLIKELY(status != UCS_OK)) {
417418
MCA_COMMON_UCX_ERROR("opal_common_ucx_atomic_cswap failed: %d", status);
418419
rc = OPAL_ERROR;
420+
goto out;
419421
}
420422

421423
rc = _periodical_flush_nb(mem, winfo, target);
422424
if(OPAL_UNLIKELY(OPAL_SUCCESS != rc)){
423425
MCA_COMMON_UCX_VERBOSE(1, "_incr_and_check_inflight_ops failed: %d", rc);
424-
return rc;
425426
}
426427

428+
out:
427429
opal_mutex_unlock(&winfo->mutex);
428430

429431
return rc;
@@ -470,7 +472,6 @@ opal_common_ucx_wpmem_cmpswp_nb(opal_common_ucx_wpmem_t *mem, uint64_t compare,
470472
rc = _periodical_flush_nb(mem, winfo, target);
471473
if(OPAL_UNLIKELY(OPAL_SUCCESS != rc)){
472474
MCA_COMMON_UCX_VERBOSE(1, "_incr_and_check_inflight_ops failed: %d", rc);
473-
return rc;
474475
}
475476

476477
opal_mutex_unlock(&winfo->mutex);
@@ -503,14 +504,15 @@ opal_common_ucx_wpmem_post(opal_common_ucx_wpmem_t *mem, ucp_atomic_post_op_t op
503504
if (OPAL_UNLIKELY(status != UCS_OK)) {
504505
MCA_COMMON_UCX_ERROR("ucp_atomic_post failed: %d", status);
505506
rc = OPAL_ERROR;
507+
goto out;
506508
}
507509

508510
rc = _periodical_flush_nb(mem, winfo, target);
509511
if(OPAL_UNLIKELY(OPAL_SUCCESS != rc)){
510512
MCA_COMMON_UCX_VERBOSE(1, "_incr_and_check_inflight_ops failed: %d", rc);
511-
return rc;
512513
}
513514

515+
out:
514516
opal_mutex_unlock(&winfo->mutex);
515517
return rc;
516518
}
@@ -542,14 +544,15 @@ opal_common_ucx_wpmem_fetch(opal_common_ucx_wpmem_t *mem,
542544
if (OPAL_UNLIKELY(status != UCS_OK)) {
543545
MCA_COMMON_UCX_ERROR("ucp_atomic_cswap64 failed: %d", status);
544546
rc = OPAL_ERROR;
547+
goto out;
545548
}
546549

547550
rc = _periodical_flush_nb(mem, winfo, target);
548551
if(OPAL_UNLIKELY(OPAL_SUCCESS != rc)){
549552
MCA_COMMON_UCX_VERBOSE(1, "_incr_and_check_inflight_ops failed: %d", rc);
550-
return rc;
551553
}
552554

555+
out:
553556
opal_mutex_unlock(&winfo->mutex);
554557

555558
return rc;
@@ -593,7 +596,6 @@ opal_common_ucx_wpmem_fetch_nb(opal_common_ucx_wpmem_t *mem,
593596
rc = _periodical_flush_nb(mem, winfo, target);
594597
if(OPAL_UNLIKELY(OPAL_SUCCESS != rc)){
595598
MCA_COMMON_UCX_VERBOSE(1, "_incr_and_check_inflight_ops failed: %d", rc);
596-
return rc;
597599
}
598600

599601
opal_mutex_unlock(&winfo->mutex);

0 commit comments

Comments
 (0)