]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: task: put barriers after each write to curr_task
authorWilly Tarreau <w@1wt.eu>
Fri, 17 May 2019 09:46:04 +0000 (11:46 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 17 May 2019 15:16:20 +0000 (17:16 +0200)
This one may be watched by signal handlers, we don't want the compiler
to optimize its assignment away at the end of the loop and leave some
wandering pointers there.

src/task.c

index 0e5419da7ec96bf6d1f2953f7798c76a7d5cb2b0..afdd2b85e48c703471eea3d9c4d9963c876fc465 100644 (file)
@@ -385,6 +385,7 @@ void process_runnable_tasks()
                }
 
                curr_task = (struct task *)t;
+               __ha_barrier_store();
                if (likely(process == process_stream))
                        t = process_stream(t, ctx, state);
                else if (process != NULL)
@@ -392,6 +393,7 @@ void process_runnable_tasks()
                else {
                        __task_free(t);
                        curr_task = NULL;
+                       __ha_barrier_store();
                        /* We don't want max_processed to be decremented if
                         * we're just freeing a destroyed task, we should only
                         * do so if we really ran a task.
@@ -399,6 +401,7 @@ void process_runnable_tasks()
                        continue;
                }
                curr_task = NULL;
+               __ha_barrier_store();
                /* If there is a pending state  we have to wake up the task
                 * immediately, else we defer it into wait queue
                 */