]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: epoll/threads: only call epoll_ctl(DEL) on polled FDs
authorWilly Tarreau <w@1wt.eu>
Wed, 31 Jan 2018 08:49:29 +0000 (09:49 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 31 Jan 2018 08:49:29 +0000 (09:49 +0100)
Commit d9e7e36 ("BUG/MEDIUM: epoll/threads: use one epoll_fd per thread")
addressed an issue with the polling and required that cloned FDs are removed
from all polling threads on close. But in fact it does it for all bound
threads, some of which may not necessarily poll the FD. This is harmless,
but it may also make it harder later to deal with FD migration between
threads. Better use polled_mask which only reports threads still aware
of the FD instead of thread_mask.

This fix should be backported to 1.8.

src/ev_epoll.c

index 0dd908dbcd2d5d8703a6bd7afc0c38cfb5f8e5c9..924c083b251a5091a71b8b7f1eed1f0b974e60aa 100644 (file)
@@ -50,7 +50,7 @@ static THREAD_LOCAL struct epoll_event ev;
 REGPRM1 static void __fd_clo(int fd)
 {
        if (unlikely(fdtab[fd].cloned)) {
-               unsigned long m = fdtab[fd].thread_mask;
+               unsigned long m = fdtab[fd].polled_mask;
                int i;
 
                for (i = global.nbthread - 1; i >= 0; i--)