Skip to content

Commit adb6682

Browse files
committed
btl/ugni: fix another connection race
This commit fixes a race that can occur when two threads are in the ugni progress function at the same time. This race occurs when one thread calls GNI_PostDataProbeById then goes to sleep then another thread calls GNI_PostDataProbeById then GNI_EpPostDataWaitById before the other thread wakes up. If this happens the first thread will print a warning on GNI_EpPostDataWaitById about no matching post. Signed-off-by: Nathan Hjelm <[email protected]>
1 parent ba77d9b commit adb6682

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

opal/mca/btl/ugni/btl_ugni_component.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,8 @@ mca_btl_ugni_progress_datagram (mca_btl_ugni_module_t *ugni_module)
430430
/* check for datagram completion */
431431
OPAL_THREAD_LOCK(&ugni_module->device->dev_lock); /* TODO: may not need lock for this function */
432432
grc = GNI_PostDataProbeById (ugni_module->device->dev_handle, &datagram_id);
433-
OPAL_THREAD_UNLOCK(&ugni_module->device->dev_lock);
434433
if (OPAL_LIKELY(GNI_RC_SUCCESS != grc)) {
434+
OPAL_THREAD_UNLOCK(&ugni_module->device->dev_lock);
435435
return 0;
436436
}
437437

@@ -447,7 +447,6 @@ mca_btl_ugni_progress_datagram (mca_btl_ugni_module_t *ugni_module)
447447
}
448448

449449
/* wait for the incoming datagram to complete (in case it isn't) */
450-
OPAL_THREAD_LOCK(&ugni_module->device->dev_lock); /* TODO: may not need lock for this function */
451450
grc = GNI_EpPostDataWaitById (handle, datagram_id, -1, &post_state,
452451
&remote_addr, &remote_id);
453452
OPAL_THREAD_UNLOCK(&ugni_module->device->dev_lock);

0 commit comments

Comments
 (0)