From: Willy Tarreau Date: Thu, 7 Jul 2022 06:29:00 +0000 (+0200) Subject: MEDIUM: fd: make fd_insert() take local thread masks X-Git-Tag: v2.7-dev2~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=27a32455994993f865aecd5c9b551bc79db441c5;p=thirdparty%2Fhaproxy.git MEDIUM: fd: make fd_insert() take local thread masks fd_insert() was already given a thread group ID and a global thread mask. Now we're changing the few callers to take the group-local thread mask instead. It's passed directly into the FD's thread mask. Just like for previous commit, it must not change anything when a single group is configured. --- diff --git a/src/dns.c b/src/dns.c index a77e71fdfb..7a5ddae980 100644 --- a/src/dns.c +++ b/src/dns.c @@ -74,7 +74,7 @@ static int dns_connect_nameserver(struct dns_nameserver *ns) /* Add the fd in the fd list and update its parameters */ dgram->t.sock.fd = fd; - fd_insert(fd, dgram, dgram_fd_handler, tgid, all_threads_mask); + fd_insert(fd, dgram, dgram_fd_handler, tgid, tg->threads_enabled); fd_want_recv(fd); return 0; } diff --git a/src/fd.c b/src/fd.c index d412c28589..5cb4fa1257 100644 --- a/src/fd.c +++ b/src/fd.c @@ -855,8 +855,8 @@ static int init_pollers_per_thread() poller_rd_pipe = mypipe[0]; poller_wr_pipe[tid] = mypipe[1]; fd_set_nonblock(poller_rd_pipe); - fd_insert(poller_rd_pipe, poller_pipe_io_handler, poller_pipe_io_handler, tgid, tid_bit); - fd_insert(poller_wr_pipe[tid], poller_pipe_io_handler, poller_pipe_io_handler, tgid, tid_bit); + fd_insert(poller_rd_pipe, poller_pipe_io_handler, poller_pipe_io_handler, tgid, ti->ltid_bit); + fd_insert(poller_wr_pipe[tid], poller_pipe_io_handler, poller_pipe_io_handler, tgid, ti->ltid_bit); fd_want_recv(poller_rd_pipe); fd_stop_both(poller_wr_pipe[tid]); return 1; diff --git a/src/sock.c b/src/sock.c index 43e30df1db..a74e8194b2 100644 --- a/src/sock.c +++ b/src/sock.c @@ -703,7 +703,7 @@ void sock_accept_iocb(int fd) void sock_conn_ctrl_init(struct connection *conn) { BUG_ON(conn->flags & CO_FL_FDLESS); - fd_insert(conn->handle.fd, conn, sock_conn_iocb, tgid, tid_bit); + fd_insert(conn->handle.fd, conn, sock_conn_iocb, tgid, ti->ltid_bit); } /* This completes the release of connection by removing its FD from the diff --git a/src/ssl_sock.c b/src/ssl_sock.c index 00f024023e..1d39826e69 100644 --- a/src/ssl_sock.c +++ b/src/ssl_sock.c @@ -824,7 +824,7 @@ static inline void ssl_async_process_fds(struct ssl_sock_ctx *ctx) /* We add new fds to the fdtab */ for (i=0 ; i < num_add_fds ; i++) { - fd_insert(add_fd[i], ctx, ssl_async_fd_handler, tgid, tid_bit); + fd_insert(add_fd[i], ctx, ssl_async_fd_handler, tgid, ti->ltid_bit); } num_add_fds = 0;