f7e4ba6fa8dc339cd0f37df60015a555ba9dff91
[openwrt-packages.git] /
1 commit 75795017480da0f0a1157e945043249fe625f92f
2 Author: Willy Tarreau <w@1wt.eu>
3 Date:   Tue Oct 16 16:11:56 2018 +0200
4
5     BUG/MEDIUM: threads: fix thread_release() at the end of the rendez-vous point
6     
7     There is a bug in this function used to release other threads. It leaves
8     the current thread marked as harmless. If after this another thread does
9     a thread_isolate(), but before the first one reaches poll(), the second
10     thread will believe it's alone while it's not.
11     
12     This must be backported to 1.8 since the rendez-vous point was merged
13     into 1.8.14.
14     
15     (cherry picked from commit a9c0252b2e8ff7bb728b84d977ac6e9581ea12f8)
16     Signed-off-by: Willy Tarreau <w@1wt.eu>
17
18 diff --git a/src/hathreads.c b/src/hathreads.c
19 index 9dba4356..0a7c12f7 100644
20 --- a/src/hathreads.c
21 +++ b/src/hathreads.c
22 @@ -221,12 +221,8 @@ void thread_isolate()
23   */
24  void thread_release()
25  {
26 -       while (1) {
27 -               HA_ATOMIC_AND(&threads_want_rdv_mask, ~tid_bit);
28 -               if (!(threads_want_rdv_mask & all_threads_mask))
29 -                       break;
30 -               thread_harmless_till_end();
31 -       }
32 +       HA_ATOMIC_AND(&threads_want_rdv_mask, ~tid_bit);
33 +       thread_harmless_end();
34  }
35  
36  __attribute__((constructor))
git clone https://git.99rst.org/PROJECT