]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: tasks/debug: add a BUG_ON() check to detect requeued task on free
authorWilly Tarreau <w@1wt.eu>
Wed, 22 Jul 2020 12:33:53 +0000 (14:33 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 22 Jul 2020 12:42:52 +0000 (14:42 +0200)
__task_free() cannot be called with a task still in the queue. This
test adds a check which confirms there is no concurrency issue on such
a case where a thread could requeue nor wakeup a task being freed.

include/haproxy/task.h

index 820c2f1dd2026229121fcfeef026c150e501cba0..24be2b6ed475baf17f2d7eba1053bc59345e749a 100644 (file)
@@ -473,6 +473,7 @@ static inline void __task_free(struct task *t)
                sched->current = NULL;
                __ha_barrier_store();
        }
+       BUG_ON(task_in_wq(t) || task_in_rq(t));
        pool_free(pool_head_task, t);
        if (unlikely(stopping))
                pool_flush(pool_head_task);