]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: fd: remove the unneeded running bit from fd_insert()
authorWilly Tarreau <w@1wt.eu>
Wed, 24 Mar 2021 09:42:16 +0000 (10:42 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 24 Mar 2021 16:17:21 +0000 (17:17 +0100)
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

index 69eda485f5cb5fbe09636dca681360c9152ce6ae..c0a6957ad2dc0c940ccef7c9e95644d0c49d1f21 100644 (file)
@@ -432,11 +432,8 @@ static inline void fd_update_events(int fd, unsigned char evts)
 /* Prepares <fd> 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);