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.
This commit is contained in:
Willy Tarreau 2021-03-24 10:42:16 +01:00
parent 6e8e10b415
commit 71bada5ca4
1 changed files with 1 additions and 5 deletions

View 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);