From: Willy Tarreau Date: Wed, 22 Jul 2020 12:33:53 +0000 (+0200) Subject: MINOR: tasks/debug: add a BUG_ON() check to detect requeued task on free X-Git-Tag: v2.3-dev2~38 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f2452b3c70762ee0917a95dc1634770f5611e2e3;p=thirdparty%2Fhaproxy.git 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. --- 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);