From 73072853e38327abcc602a28d00316585fd25987 Mon Sep 17 00:00:00 2001 From: Evgeny Leksikov Date: Tue, 20 Apr 2021 11:19:12 +0300 Subject: [PATCH] UCP/STREAM: fix a race condition when connecting to sockaddr trying to send before connection is established on client side can cause a race condition with EP reconfiguration in ucp_cm_client_priv_pack_cb on async thread --- src/ucp/stream/stream_send.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ucp/stream/stream_send.c b/src/ucp/stream/stream_send.c index fcda9096f0e..76dda8541e1 100644 --- a/src/ucp/stream/stream_send.c +++ b/src/ucp/stream/stream_send.c @@ -93,7 +93,7 @@ UCS_PROFILE_FUNC(ucs_status_ptr_t, ucp_stream_send_nb, UCP_CONTEXT_CHECK_FEATURE_FLAGS(ep->worker->context, UCP_FEATURE_STREAM, return UCS_STATUS_PTR(UCS_ERR_INVALID_PARAM)); - UCP_WORKER_THREAD_CS_ENTER_CONDITIONAL(ep->worker); + UCS_ASYNC_BLOCK(&ep->worker->async); ucs_trace_req("stream_send_nb buffer %p count %zu to %s cb %p flags %u", buffer, count, ucp_ep_peer_name(ep), cb, flags); @@ -135,7 +135,7 @@ UCS_PROFILE_FUNC(ucs_status_ptr_t, ucp_stream_send_nb, ucp_ep_config(ep)->stream.proto); out: - UCP_WORKER_THREAD_CS_EXIT_CONDITIONAL(ep->worker); + UCS_ASYNC_UNBLOCK(&ep->worker->async); return ret; }