Skip to content

Commit 07bb274

Browse files
author
Tomislav Janjusic
committed
oshmem: fix, race condition on new context
Do not add private contexts to active list, they need only be visible to user Signed-off-by: Tomislav Janjusic <[email protected]> Signed-off-by: Artem Y. Polyakov <[email protected]>
1 parent 40e2fbb commit 07bb274

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

oshmem/mca/spml/ucx/spml_ucx.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,11 @@ int mca_spml_ucx_ctx_create(long options, shmem_ctx_t *ctx)
698698
opal_progress_register(spml_ucx_ctx_progress);
699699
}
700700

701+
if (options & SHMEM_CTX_PRIVATE) {
702+
(*ctx) = (shmem_ctx_t)ucx_ctx;
703+
return OSHMEM_SUCCESS;
704+
}
705+
701706
SHMEM_MUTEX_LOCK(mca_spml_ucx.internal_mutex);
702707
_ctx_add(&mca_spml_ucx.active_array, ucx_ctx);
703708
SHMEM_MUTEX_UNLOCK(mca_spml_ucx.internal_mutex);
@@ -711,7 +716,9 @@ void mca_spml_ucx_ctx_destroy(shmem_ctx_t ctx)
711716
MCA_SPML_CALL(quiet(ctx));
712717

713718
SHMEM_MUTEX_LOCK(mca_spml_ucx.internal_mutex);
714-
_ctx_remove(&mca_spml_ucx.active_array, (mca_spml_ucx_ctx_t *)ctx);
719+
if (!(((mca_spml_ucx_ctx_t *)ctx)->options & SHMEM_CTX_PRIVATE)) {
720+
_ctx_remove(&mca_spml_ucx.active_array, (mca_spml_ucx_ctx_t *)ctx);
721+
}
715722
_ctx_add(&mca_spml_ucx.idle_array, (mca_spml_ucx_ctx_t *)ctx);
716723
SHMEM_MUTEX_UNLOCK(mca_spml_ucx.internal_mutex);
717724

0 commit comments

Comments
 (0)