On Tue, Oct 21, 2025 at 02:14:02PM +0200, Laurent Vivier wrote:
On 20/10/2025 03:34, David Gibson wrote:
@@ -570,7 +572,8 @@ static void tcp_timer_ctl(const struct ctx *c, struct tcp_tap_conn *conn) } conn->timer = fd; - if (epoll_ctl(c->epollfd, EPOLL_CTL_ADD, conn->timer, &ev)) { + if (epoll_ctl(flow_epollfd(&conn->f), EPOLL_CTL_ADD, + conn->timer, &ev)) { Possibly a question for an earlier patch, but is there a reason we can't use epoll_add() here?
Yes, the fd we use in epoll_ctl() and the fd stored in ref are not the same.
The fd in ref is conn->sock (epoll_add() takes fd from ref) but in epoll_ctl() we add conn->timer (the fd from timerfd_create()).
Huh. That seems like a pre-existing bug. I'm pretty sure the epoll ref for the timer ought to have the timer's fd in it. I suspect we just never previously used the ref.fd field for this case. -- David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson