From: Willy Tarreau Date: Wed, 31 Jan 2018 08:49:29 +0000 (+0100) Subject: BUG/MINOR: epoll/threads: only call epoll_ctl(DEL) on polled FDs X-Git-Tag: v1.9-dev1~467 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=497959290789002b814b9021a737a3c5f14e7407;p=thirdparty%2Fhaproxy.git BUG/MINOR: epoll/threads: only call epoll_ctl(DEL) on polled FDs 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. --- diff --git a/src/ev_epoll.c b/src/ev_epoll.c index 0dd908dbcd..924c083b25 100644 --- a/src/ev_epoll.c +++ b/src/ev_epoll.c @@ -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--)