From 6956b15da0412d44b84a5c73b1f91ac51dd611f8 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Wed, 14 Apr 2021 14:02:25 +0200 Subject: [PATCH] BUG/MEDIUM: threads: Ignore current thread to end its harmless period A previous patch was pushed to fix a deadlock when an isolated thread ends its harmless period (a9a9e9aac ["BUG/MEDIUM: thread: Fix a deadlock if an isolated thread is marked as harmless"]). But, unfortunately, the fix is incomplete. The same must be done in the outer loop, in thread_harmless_end() function. The current thread must be ignored when threads_want_rdv_mask mask is tested. This patch must also be backported as far as 2.0. (cherry picked from commit f63a18550073e821976606f9602c261976939ae9) Signed-off-by: Christopher Faulet (cherry picked from commit a3259cb81e3960e5e45fe03a890a094002f3e283) Signed-off-by: Christopher Faulet (cherry picked from commit 741fbe493d5bc64d7c609a50864d7f073f8e0f05) Signed-off-by: Christopher Faulet --- include/common/hathreads.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/common/hathreads.h b/include/common/hathreads.h index 9f83528..f4566b3 100644 --- a/include/common/hathreads.h +++ b/include/common/hathreads.h @@ -557,7 +557,7 @@ static inline void thread_harmless_end() { while (1) { HA_ATOMIC_AND(&threads_harmless_mask, ~tid_bit); - if (likely((threads_want_rdv_mask & all_threads_mask) == 0)) + if (likely((threads_want_rdv_mask & ~tid_bit) == 0)) break; thread_harmless_till_end(); } -- 1.7.10.4