From 27265127d81d9e6d076937732bc50d7f51194773 Mon Sep 17 00:00:00 2001 From: Yossi Itigin Date: Thu, 22 Nov 2018 18:09:24 +0200 Subject: [PATCH] UCT/MM: Fix endpoint flush - don't update cached tail We must not update cached tail in uct_mm_ep_flush() if there are any pending elements. We may get new send resources but not use them, so flush could return UCS_OK while there pending requests. Fixes #3052 --- src/uct/sm/mm/mm_ep.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/uct/sm/mm/mm_ep.c b/src/uct/sm/mm/mm_ep.c index 2c66d387802..5d369934866 100644 --- a/src/uct/sm/mm/mm_ep.c +++ b/src/uct/sm/mm/mm_ep.c @@ -419,10 +419,15 @@ ucs_status_t uct_mm_ep_flush(uct_ep_h tl_ep, unsigned flags, { uct_mm_ep_t *ep = ucs_derived_of(tl_ep, uct_mm_ep_t); - uct_mm_ep_update_cached_tail(ep); - if (!uct_mm_ep_has_tx_resources(ep)) { - return UCS_ERR_NO_RESOURCE; + if (!ucs_arbiter_group_is_empty(&ep->arb_group)) { + return UCS_ERR_NO_RESOURCE; + } else { + uct_mm_ep_update_cached_tail(ep); + if (!uct_mm_ep_has_tx_resources(ep)) { + return UCS_ERR_NO_RESOURCE; + } + } } ucs_memory_cpu_store_fence();