From 497959290789002b814b9021a737a3c5f14e7407 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 31 Jan 2018 09:49:29 +0100 Subject: [PATCH] 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. --- src/ev_epoll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ev_epoll.c b/src/ev_epoll.c index 0dd908dbc..924c083b2 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--) -- 2.47.3