]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: wdt: use ltid_bit in wdt_handler()
authorWilly Tarreau <w@1wt.eu>
Mon, 27 Jun 2022 14:20:13 +0000 (16:20 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 1 Jul 2022 17:15:14 +0000 (19:15 +0200)
Since commit cc7a11ee3 ("MINOR: threads: set the tid, ltid and their bit
in thread_cfg") we ought not use (1UL << thr) to get the group mask for
thread <thr>, but (ha_thread_info[thr].ltid_bit). wdt_handler() needs
this.

src/wdt.c

index fab1269f0931d400d4dfad0dd716953b37af157d..20297bcb9c7e820fed00e258ede89444e3ef84b2 100644 (file)
--- a/src/wdt.c
+++ b/src/wdt.c
@@ -53,6 +53,7 @@ int wdt_ping(int thr)
 void wdt_handler(int sig, siginfo_t *si, void *arg)
 {
        unsigned long long n, p;
+       ulong thr_bit;
        int thr;
 
        switch (si->si_code) {
@@ -71,6 +72,7 @@ void wdt_handler(int sig, siginfo_t *si, void *arg)
                if (thr < 0 || thr >= global.nbthread)
                        break;
 
+               thr_bit = ha_thread_info[thr].ltid_bit;
                p = ha_thread_ctx[thr].prev_cpu_time;
                n = now_cpu_time_thread(thr);
 
@@ -81,7 +83,7 @@ void wdt_handler(int sig, siginfo_t *si, void *arg)
                        goto update_and_leave;
 
                if ((_HA_ATOMIC_LOAD(&th_ctx->flags) & TH_FL_SLEEPING) &&
-                   ((threads_harmless_mask|threads_to_dump) & (1UL << thr))) {
+                   ((threads_harmless_mask|threads_to_dump) & thr_bit)) {
                        /* This thread is currently doing exactly nothing
                         * waiting in the poll loop (unlikely but possible),
                         * waiting for all other threads to join the rendez-vous