mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-25 07:41:36 +02:00
MINOR: task: always reset curr_task when freeing a task or tasklet
With the thread debugger it becomes visible that we can leave some wandering pointers for a while in curr_task, which is inappropriate. This patch addresses this by resetting curr_task to NULL before really freeing the area. This way it becomes safe even regarding signals.
This commit is contained in:
parent
01f3489752
commit
29bf96d73d
@ -319,11 +319,15 @@ static inline struct task *task_new(unsigned long thread_mask)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Free a task. Its context must have been freed since it will be lost.
|
* Free a task. Its context must have been freed since it will be lost. The
|
||||||
* The task count is decremented.
|
* task count is decremented. It it is the current task, this one is reset.
|
||||||
*/
|
*/
|
||||||
static inline void __task_free(struct task *t)
|
static inline void __task_free(struct task *t)
|
||||||
{
|
{
|
||||||
|
if (t == curr_task) {
|
||||||
|
curr_task = NULL;
|
||||||
|
__ha_barrier_store();
|
||||||
|
}
|
||||||
pool_free(pool_head_task, t);
|
pool_free(pool_head_task, t);
|
||||||
if (unlikely(stopping))
|
if (unlikely(stopping))
|
||||||
pool_flush(pool_head_task);
|
pool_flush(pool_head_task);
|
||||||
@ -363,6 +367,10 @@ static inline void tasklet_free(struct tasklet *tl)
|
|||||||
_HA_ATOMIC_SUB(&tasks_run_queue, 1);
|
_HA_ATOMIC_SUB(&tasks_run_queue, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((struct task *)tl == curr_task) {
|
||||||
|
curr_task = NULL;
|
||||||
|
__ha_barrier_store();
|
||||||
|
}
|
||||||
pool_free(pool_head_tasklet, tl);
|
pool_free(pool_head_tasklet, tl);
|
||||||
if (unlikely(stopping))
|
if (unlikely(stopping))
|
||||||
pool_flush(pool_head_tasklet);
|
pool_flush(pool_head_tasklet);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user