]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: task: make sched->current also reflect tasklets
authorWilly Tarreau <w@1wt.eu>
Fri, 31 Jan 2020 09:39:03 +0000 (10:39 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 31 Jan 2020 16:45:10 +0000 (17:45 +0100)
sched->current is used to know the current task/tasklet, and is currently
only used by the panic dump code. However it turns out it was not set for
tasklets, which prevents us from using it for more usages, despite the
panic handling code already handling this case very well. Let's make sure
it's now set.

src/task.c

index f1f36a914f70973de6ab4107fa8e760320f6104a..f7bfd893aa0ee7386af79f15af89e0f91f2ecec8 100644 (file)
@@ -339,10 +339,13 @@ static int run_tasks_from_list(struct list *list, int max)
                ctx = t->context;
                process = t->process;
                t->calls++;
+               sched->current = t;
 
                if (TASK_IS_TASKLET(t)) {
                        process(NULL, ctx, state);
                        done++;
+                       sched->current = NULL;
+                       __ha_barrier_store();
                        continue;
                }
 
@@ -356,7 +359,6 @@ static int run_tasks_from_list(struct list *list, int max)
                        t->call_date = now_ns;
                }
 
-               sched->current = t;
                __ha_barrier_store();
                if (likely(process == process_stream))
                        t = process_stream(t, ctx, state);