]> git.kaiwu.me - haproxy.git/commit
CLEANUP: task: make sure tasklet handlers always indicate their statuses
authorWilly Tarreau <w@1wt.eu>
Sat, 13 Mar 2021 10:30:19 +0000 (11:30 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 13 Mar 2021 10:30:19 +0000 (11:30 +0100)
commit741631414578fc19c9cdd213bf0b32a559c7fcba
treed2635b42b0d172a2c12f591f120d0ddab22a9294
parent4975d1482f11e0499c09479461cdf10e034539b5
CLEANUP: task: make sure tasklet handlers always indicate their statuses

When tasklets were derived from tasks, there was no immediate need for
the scheduler to know their status after execution, and in a spirit of
simplicity they just started to always return NULL. The problem is that
it simply prevents the scheduler from 1) accounting their execution time,
and 2) keeping track of their current execution status. Indeed, a remote
wake-up could very well end up manipulating a tasklet that's currently
being executed. And this is the reason why those handlers have to take
the idle lock before checking their context.

In 2.5 we'll take care of making tasklets and tasks work more similarly,
but trouble is to be expected if we continue to propagate the trend of
returning NULL everywhere, especially if some fixes relying on a stricter
model later need to be backported. For this reason this patch updates all
known tasklet handlers to make them return NULL only when the tasklet was
freed. It has no effect for now and isn't even guaranteed to always be
100% safe but it puts the code into the right direction for this.
include/haproxy/task-t.h
src/mux_fcgi.c
src/mux_h1.c
src/mux_h2.c
src/mux_pt.c
src/ssl_sock.c
src/stream_interface.c
src/xprt_handshake.c
src/xprt_quic.c