]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] ev_sepoll: closed file descriptors could persist in the spec list
authorWilly Tarreau <w@1wt.eu>
Sat, 16 Aug 2008 14:06:02 +0000 (16:06 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 2 Sep 2008 09:01:49 +0000 (11:01 +0200)
If __fd_clo() was called on a file descriptor which was previously
disabled, it was not removed from the spec list. This apparently
could not happen on previous code because the TCP states prevented
this, but now it happens regularly. The effects are spec entries
stuck populated, leading to busy loops.

(cherry picked from commit 7a52a5c4680477272b2f34eaf5896b85746e6fd6)

src/ev_sepoll.c

index 800ac0bab2d763d013a3667dc500b0557a7c381c..db35423574af592d5e2dc44c8ed050a54583ee32 100644 (file)
@@ -279,8 +279,7 @@ REGPRM1 static void __fd_rem(int fd)
  */
 REGPRM1 static void __fd_clo(int fd)
 {
-       if (fd_list[fd].e & FD_EV_RW_SL)
-               release_spec_entry(fd);
+       release_spec_entry(fd);
        fd_list[fd].e &= ~(FD_EV_MASK);
 }
 
@@ -325,7 +324,7 @@ REGPRM2 static void _do_poll(struct poller *p, struct timeval *exp)
                fdtab[fd].ev &= FD_POLL_STICKY;
                if ((eo & FD_EV_MASK_R) == FD_EV_SPEC_R) {
                        /* The owner is interested in reading from this FD */
-                       if (fdtab[fd].state != FD_STCLOSE && fdtab[fd].state != FD_STERROR) {
+                       if (fdtab[fd].state != FD_STERROR) {
                                /* Pretend there is something to read */
                                fdtab[fd].ev |= FD_POLL_IN;
                                if (!fdtab[fd].cb[DIR_RD].f(fd))
@@ -341,7 +340,7 @@ REGPRM2 static void _do_poll(struct poller *p, struct timeval *exp)
                
                if ((eo & FD_EV_MASK_W) == FD_EV_SPEC_W) {
                        /* The owner is interested in writing to this FD */
-                       if (fdtab[fd].state != FD_STCLOSE && fdtab[fd].state != FD_STERROR) {
+                       if (fdtab[fd].state != FD_STERROR) {
                                /* Pretend there is something to write */
                                fdtab[fd].ev |= FD_POLL_OUT;
                                if (!fdtab[fd].cb[DIR_WR].f(fd))