]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: fd: Call fd_stop_recv() when we just got a fd.
authorOlivier Houchard <cognet@ci0.org>
Wed, 17 Jun 2020 18:34:05 +0000 (20:34 +0200)
committerOlivier Houchard <cognet@ci0.org>
Wed, 17 Jun 2020 18:36:28 +0000 (20:36 +0200)
In fd_takeover(), when a double-width compare-and-swap is implemented,
make sure, if we managed to get the fd, to call fd_stop_recv() on it, so
that the thread that used to own it will know it has to stop polling it.

src/fd.c

index 1fcf1d43c7d951836fdcb3d1eba3257768aa824c..51740c39aba02c88c7b48bc1e68e18c093ee3522 100644 (file)
--- a/src/fd.c
+++ b/src/fd.c
@@ -389,6 +389,12 @@ end:
        } while (!(_HA_ATOMIC_DWCAS(&fdtab[fd].running_mask, &old_masks,
                   &new_masks)));
        _HA_ATOMIC_AND(&fdtab[fd].running_mask, ~tid_bit);
+       /* Make sure the FD doesn't have the active bit. It is possible that
+        * the fd is polled by the thread that used to own it, the new thread
+        * is supposed to call subscribe() later, to activate polling.
+        */
+       fd_stop_recv(fd);
+
        return 0;
 #endif /* HW_HAVE_CAS_DW */
 }