]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: task: fix thread assignment in tasklet_kill()
authorWilly Tarreau <w@1wt.eu>
Wed, 15 Jun 2022 13:54:56 +0000 (15:54 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 16 Jun 2022 16:17:44 +0000 (18:17 +0200)
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

index 04d11f7349c7a4a2de6dfc89279ec90c76b210ed..515a43d6575da7ff80ba11db4bef472b1e61b72d 100644 (file)
@@ -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);