From: Christopher Faulet Date: Thu, 1 Jun 2017 14:55:03 +0000 (+0200) Subject: MINOR: fd: Don't forget to reset fdtab[fd].update when a fd is added/removed X-Git-Tag: v1.8-dev3~133 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d531f88622490af3c740b4f2935ea5e46ff30c47;p=thirdparty%2Fhaproxy.git MINOR: fd: Don't forget to reset fdtab[fd].update when a fd is added/removed It used to be guaranteed by the polling functions on a later call but with concurrent accesses it cannot be granted anymore. --- diff --git a/include/proto/fd.h b/include/proto/fd.h index 1efe32399a..38c12b687e 100644 --- a/include/proto/fd.h +++ b/include/proto/fd.h @@ -338,6 +338,7 @@ static inline void fd_insert(int fd) { fdtab[fd].ev = 0; fdtab[fd].new = 1; + fdtab[fd].updated = 0; fdtab[fd].linger_risk = 0; fdtab[fd].cloned = 0; if (fd + 1 > maxfd) diff --git a/src/fd.c b/src/fd.c index 1a62f9a669..c197557be1 100644 --- a/src/fd.c +++ b/src/fd.c @@ -190,10 +190,11 @@ static void fd_dodelete(int fd, int do_close) port_range_release_port(fdinfo[fd].port_range, fdinfo[fd].local_port); fdinfo[fd].port_range = NULL; - if (do_close) - close(fd); fdtab[fd].owner = NULL; + fdtab[fd].updated = 0; fdtab[fd].new = 0; + if (do_close) + close(fd); while ((maxfd-1 >= 0) && !fdtab[maxfd-1].owner) maxfd--;