From c64666a187178e3300243ecc34b9070ff86da7cd Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Tue, 20 Jul 2021 14:30:51 +0300 Subject: [PATCH] UCP/REQUEST: added fake callback into request_put - added fake callback into request_put routine to handle incorrectly completed cases --- src/ucp/core/ucp_request.inl | 13 +++++++++++++ src/ucs/sys/stubs.c | 5 +++++ src/ucs/sys/stubs.h | 1 + 3 files changed, 19 insertions(+) diff --git a/src/ucp/core/ucp_request.inl b/src/ucp/core/ucp_request.inl index 06f45e331f8..da594792aa3 100644 --- a/src/ucp/core/ucp_request.inl +++ b/src/ucp/core/ucp_request.inl @@ -171,6 +171,18 @@ } +#if UCS_ENABLE_ASSERT +# define UCP_REQUEST_RESET(_req) \ + (_req)->send.uct.func = \ + (uct_pending_callback_t)ucs_empty_function_do_assert; \ + (_req)->send.state.uct_comp.func = \ + (uct_completion_callback_t)ucs_empty_function_do_assert_void; \ + (_req)->send.state.uct_comp.count = 0; +#else /* UCS_ENABLE_ASSERT */ +# define UCP_REQUEST_RESET(_req) +#endif /* UCS_ENABLE_ASSERT */ + + static UCS_F_ALWAYS_INLINE void ucp_request_id_reset(ucp_request_t *req) { req->id = UCS_PTR_MAP_KEY_INVALID; @@ -190,6 +202,7 @@ ucp_request_put(ucp_request_t *req) ucs_trace_req("put request %p", req); ucp_request_id_check(req, ==, UCS_PTR_MAP_KEY_INVALID); UCS_PROFILE_REQUEST_FREE(req); + UCP_REQUEST_RESET(req); ucs_mpool_put_inline(req); } diff --git a/src/ucs/sys/stubs.c b/src/ucs/sys/stubs.c index d7e85359acc..25d99383d24 100644 --- a/src/ucs/sys/stubs.c +++ b/src/ucs/sys/stubs.c @@ -96,3 +96,8 @@ int ucs_empty_function_do_assert() ucs_assert_always(0); return 0; } + +void ucs_empty_function_do_assert_void() +{ + ucs_assert_always(0); +} diff --git a/src/ucs/sys/stubs.h b/src/ucs/sys/stubs.h index 9c2392b8447..3261fb360b4 100644 --- a/src/ucs/sys/stubs.h +++ b/src/ucs/sys/stubs.h @@ -37,6 +37,7 @@ ucs_status_t ucs_empty_function_return_ep_timeout(); ssize_t ucs_empty_function_return_bc_ep_timeout(); ucs_status_t ucs_empty_function_return_busy(); int ucs_empty_function_do_assert(); +void ucs_empty_function_do_assert_void(); END_C_DECLS