From 71bada5ca45cdf6d433e699ac0c7f7d78092ed02 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 24 Mar 2021 10:42:16 +0100 Subject: [PATCH] MINOR: fd: remove the unneeded running bit from fd_insert() There's no point taking the running bit in fd_insert() since by definition there will never be more than one thread inserting the FD, and that fd_insert() may only be done after the fd was allocated by the system, indicating the end of use by any other thread. This will need to be backported to 2.2 to fix an issue. --- include/haproxy/fd.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/include/haproxy/fd.h b/include/haproxy/fd.h index 69eda485f5..c0a6957ad2 100644 --- a/include/haproxy/fd.h +++ b/include/haproxy/fd.h @@ -432,11 +432,8 @@ static inline void fd_update_events(int fd, unsigned char evts) /* Prepares for being polled */ static inline void fd_insert(int fd, void *owner, void (*iocb)(int fd), unsigned long thread_mask) { - int locked = fdtab[fd].running_mask != tid_bit; extern void sock_conn_iocb(int); - if (locked) - fd_set_running_excl(fd); fdtab[fd].owner = owner; fdtab[fd].iocb = iocb; fdtab[fd].ev = 0; @@ -456,8 +453,7 @@ static inline void fd_insert(int fd, void *owner, void (*iocb)(int fd), unsigned /* note: do not reset polled_mask here as it indicates which poller * still knows this FD from a possible previous round. */ - if (locked) - fd_clr_running(fd); + /* the two directions are ready until proven otherwise */ fd_may_both(fd); _HA_ATOMIC_ADD(&ha_used_fds, 1); -- 2.47.3