From a3906875eddf0df3b5eaca2d73e9f61014b6ad7e Mon Sep 17 00:00:00 2001 From: dmitrygx Date: Thu, 2 Sep 2021 15:02:39 +0300 Subject: [PATCH] UCP/CORE: Increment completion count before calling uct_ep_flush --- src/ucp/core/ucp_worker.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/ucp/core/ucp_worker.c b/src/ucp/core/ucp_worker.c index 28469f65c08..03ae7686600 100644 --- a/src/ucp/core/ucp_worker.c +++ b/src/ucp/core/ucp_worker.c @@ -2286,16 +2286,17 @@ ucp_worker_discard_uct_ep_pending_cb(uct_pending_req_t *self) uct_ep_h uct_ep = req->send.discard_uct_ep.uct_ep; ucs_status_t status; + ++req->send.state.uct_comp.count; status = uct_ep_flush(uct_ep, req->send.discard_uct_ep.ep_flush_flags, &req->send.state.uct_comp); - if (status == UCS_OK) { - ucs_assert(req->send.state.uct_comp.count == 0); - ucp_worker_discard_uct_ep_flush_comp(&req->send.state.uct_comp); - return UCS_OK; - } else if (status == UCS_INPROGRESS) { - req->send.state.uct_comp.count++; + if (status == UCS_INPROGRESS) { return UCS_OK; - } else if (status == UCS_ERR_NO_RESOURCE) { + } + + --req->send.state.uct_comp.count; + ucs_assert(req->send.state.uct_comp.count == 0); + + if (status == UCS_ERR_NO_RESOURCE) { return UCS_ERR_NO_RESOURCE; }