From 9b3aa63df776bef42a929b7c585ae33a61a75f41 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 15 Jun 2022 15:54:56 +0200 Subject: [PATCH] BUG/MINOR: task: fix thread assignment in tasklet_kill() tasklet_kill() was introduced in 2.5-dev4 with commit 7b368339a ("MEDIUM: task: implement tasklet kill"), but a comparison error there makes tasklets killed on thread 1 assigned to the killing thread. Fortunately, the function was finally not used so there's no harm right now, hence the minor tag, but this must be fixed and backported in case a later fix relies on it. This should be backported to 2.5. --- src/task.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/task.c b/src/task.c index 04d11f734..515a43d65 100644 --- a/src/task.c +++ b/src/task.c @@ -126,7 +126,7 @@ void tasklet_kill(struct tasklet *t) * as soon as possible. */ if (_HA_ATOMIC_CAS(&t->state, &state, state | TASK_IN_LIST | TASK_KILLED)) { - thr = t->tid > 0 ? t->tid: tid; + thr = t->tid >= 0 ? t->tid : tid; MT_LIST_APPEND(&ha_thread_ctx[thr].shared_tasklet_list, list_to_mt_list(&t->list)); _HA_ATOMIC_INC(&ha_thread_ctx[thr].rq_total);