From f2452b3c70762ee0917a95dc1634770f5611e2e3 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 22 Jul 2020 14:33:53 +0200 Subject: [PATCH] MINOR: tasks/debug: add a BUG_ON() check to detect requeued task on free __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 | 1 + 1 file changed, 1 insertion(+) diff --git a/include/haproxy/task.h b/include/haproxy/task.h index 820c2f1dd2..24be2b6ed4 100644 --- a/include/haproxy/task.h +++ b/include/haproxy/task.h @@ -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); -- 2.47.3