From: Willy Tarreau Date: Wed, 15 Jun 2022 13:54:56 +0000 (+0200) Subject: BUG/MINOR: task: fix thread assignment in tasklet_kill() X-Git-Tag: v2.7-dev1~36 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9b3aa63df776bef42a929b7c585ae33a61a75f41;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/task.c b/src/task.c index 04d11f7349..515a43d657 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);