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.
This commit is contained in:
Willy Tarreau 2022-06-15 15:54:56 +02:00
parent e06f7459fa
commit 9b3aa63df7
1 changed files with 1 additions and 1 deletions

View 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);