]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG: tasks: fix bug introduced by latest scheduler cleanup
authorWilly Tarreau <w@1wt.eu>
Fri, 14 Jun 2019 16:05:54 +0000 (18:05 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 14 Jun 2019 16:16:19 +0000 (18:16 +0200)
commitbd20a9dd4e9b54e367436b7471847442b1eb91f5
tree7442ecfdf2fd8235277c54211c73b8fc82a0cd40
parentcd67bffd26561e748f897efba589425ac659f1d9
BUG: tasks: fix bug introduced by latest scheduler cleanup

In commit 86eded6c6 ("CLEANUP: tasks: rename task_remove_from_tasklet_list()
to tasklet_remove_*") which consisted in removing the casts between tasks
and tasklet, I was a bit too fast to believe that we only saw tasklets in
this function since process_runnable_tasks() also uses it with tasks under
a cast. So removing the bookkeeping on task_list_size was not appropriate.
Bah, the joy of casts which hide the real thing...

This patch does two things at once to address this mess once for all:
  - it restores the decrement of task_list_size when it's a real task,
    but moves it to process_runnable_task() since it's the only place
    where it's allowed to call it with a task

  - it moves the increment there as well and renames
    task_insert_into_tasklet_list() to tasklet_insert_into_tasklet_list()
    of obvious consistency reasons.

This way the increment/decrement of task_list_size is made at the only
places where the cast is enforced, so it has less risks to be missed.
The comments on top of these functions were updated to reflect that they
are only supposed to be used with tasklets and that the caller is responsible
for keeping task_list_size up to date if it decides to enforce a task there.

Now we don't have to worry anymore about how these functions work outside
of the scheduler, which is better longterm-wise. Thanks to Christopher for
spotting this mistake.

No backport is needed.
include/proto/task.h
src/task.c