You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.2 KiB

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