]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: listener/threads: always use atomic ops to clear the FD events
authorWilly Tarreau <w@1wt.eu>
Tue, 10 Dec 2019 07:37:04 +0000 (08:37 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 10 Dec 2019 09:43:31 +0000 (10:43 +0100)
There was a leftover of the single-threaded era when removing the
FD_POLL_HUP flag from the listeners. By not using an atomic operation
to clear the flag, another thread acting on the same listener might
have lost some events, though this would have resulted in that thread
to reprocess them immediately on the next loop pass.

This should be backported as far as 1.8.

src/listener.c

index d68a1c33359cb2d5c1df4c3b23c4d05e6b4d740e..fdb91ea38ebf9673eb8f597c567faffac37a519d 100644 (file)
@@ -799,7 +799,7 @@ void listener_accept(int fd)
                                         * a while in case it comes back. In the mean time, we need to
                                         * clear this sticky flag.
                                         */
-                                       fdtab[fd].ev &= ~FD_POLL_HUP;
+                                       _HA_ATOMIC_AND(&fdtab[fd].ev, ~FD_POLL_HUP);
                                        goto transient_error;
                                }
                                fd_cant_recv(fd);