Skip to content

Commit

Permalink
UCT/MM: Fix endpoint flush - don't update cached tail
Browse files Browse the repository at this point in the history
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 openucx#3052
  • Loading branch information
yosefe committed Nov 25, 2018
1 parent a782840 commit 2726512
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/uct/sm/mm/mm_ep.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 2726512

Please sign in to comment.