]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: task/debug: move the ->thread_mask integrity checks to ->tid
authorWilly Tarreau <w@1wt.eu>
Wed, 15 Jun 2022 12:24:57 +0000 (14:24 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 1 Jul 2022 17:15:14 +0000 (19:15 +0200)
Let's make sure the new ->tid field is always correct instead of checking
the thread mask.

include/haproxy/applet.h
include/haproxy/task.h

index 84619de481796c8f24d8115742466d3dda052d8a..68f98e2e356375fdfebc00e528e729c92fe64300 100644 (file)
@@ -70,7 +70,7 @@ static inline int appctx_init(struct appctx *appctx)
         * the appctx will be fully initialized. The session and the stream will
         * eventually be created. The affinity must be set now !
         */
-       BUG_ON((appctx->t->thread_mask & tid_bit) == 0);
+       BUG_ON(appctx->t->tid != tid);
        task_set_affinity(appctx->t, tid_bit);
 
        if (appctx->applet->init)
index d5458bfd6ff989471c46b5f8edf8559ea3e010cf..2d86452db32eab247d7b60cabfcff24eea1fdaac 100644 (file)
@@ -279,7 +279,7 @@ static inline struct task *task_unlink_wq(struct task *t)
 
        if (likely(task_in_wq(t))) {
                locked = t->state & TASK_SHARED_WQ;
-               BUG_ON(!locked && t->thread_mask != tid_bit);
+               BUG_ON(!locked && t->tid != tid);
                if (locked)
                        HA_RWLOCK_WRLOCK(TASK_WQ_LOCK, &wq_lock);
                __task_unlink_wq(t);
@@ -318,7 +318,7 @@ static inline void task_queue(struct task *task)
        } else
 #endif
        {
-               BUG_ON(task->thread_mask != tid_bit); // should have TASK_SHARED_WQ
+               BUG_ON(task->tid != tid); // should have TASK_SHARED_WQ
                if (!task_in_wq(task) || tick_is_lt(task->expire, task->wq.key))
                        __task_queue(task, &th_ctx->timers);
        }
@@ -731,7 +731,7 @@ static inline void task_schedule(struct task *task, int when)
        } else
 #endif
        {
-               BUG_ON((task->thread_mask & tid_bit) == 0); // should have TASK_SHARED_WQ
+               BUG_ON(task->tid != tid);
                if (task_in_wq(task))
                        when = tick_first(when, task->expire);