]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: applets: Don't use task_in_rq().
authorOlivier Houchard <ohouchard@haproxy.com>
Wed, 17 Apr 2019 17:29:35 +0000 (19:29 +0200)
committerOlivier Houchard <cognet@ci0.org>
Wed, 17 Apr 2019 17:30:23 +0000 (19:30 +0200)
When deciding if we want to wake the task of an applet up, don't give up
if task_in_rq returns 1, as there's a race condition and another thread
may run it. Instead, always attempt to task_wakeup(), at worst the task
is already in the run queue, and nothing will happen.

src/stream_interface.c

index 501897a84049dddbab7094028f9a3277812b2aad..1e50c1fc9199a391fc13de29c4f812e3118fbcfe 100644 (file)
@@ -1468,9 +1468,8 @@ void si_applet_wake_cb(struct stream_interface *si)
         * appctx but in the case the task is not in runqueue we may have to
         * wakeup the appctx immediately.
         */
-       if (!task_in_rq(si_task(si)) &&
-           ((si_rx_endp_ready(si) && !si_rx_blocked(si)) ||
-            (si_tx_endp_ready(si) && !si_tx_blocked(si))))
+       if ((si_rx_endp_ready(si) && !si_rx_blocked(si)) ||
+           (si_tx_endp_ready(si) && !si_tx_blocked(si)))
                appctx_wakeup(si_appctx(si));
 }