]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] stream_sock: disable I/O on fds reporting an error
authorWilly Tarreau <w@1wt.eu>
Sat, 28 Mar 2009 19:54:53 +0000 (20:54 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 28 Mar 2009 22:42:30 +0000 (23:42 +0100)
Upon read or write error, we cannot immediately close the FD because
we want to first report the error to the upper layer which will do it
itself. However, we want to prevent any further I/O from being performed
on the FD. This is especially important in case of speculative I/O where
nothing else could stop the FD from still being polled until the upper
layer takes care of the condition.

src/stream_sock.c

index 30d6b6227523cd36994fb8a42d491350f814035d..9337df81db1d97091d64a75978f56ac74cb85314 100644 (file)
@@ -495,6 +495,7 @@ int stream_sock_read(int fd) {
 
        fdtab[fd].state = FD_STERROR;
        fdtab[fd].ev &= ~FD_POLL_STICKY;
+       EV_FD_REM(fd);
        si->flags |= SI_FL_ERR;
        retval = 1;
        goto out_wakeup;
@@ -756,6 +757,7 @@ int stream_sock_write(int fd)
 
        fdtab[fd].state = FD_STERROR;
        fdtab[fd].ev &= ~FD_POLL_STICKY;
+       EV_FD_REM(fd);
        si->flags |= SI_FL_ERR;
        task_wakeup(si->owner, TASK_WOKEN_IO);
        return 1;
@@ -972,6 +974,7 @@ void stream_sock_chk_snd(struct stream_interface *si)
                 */
                fdtab[si->fd].state = FD_STERROR;
                fdtab[si->fd].ev &= ~FD_POLL_STICKY;
+               EV_FD_REM(si->fd);
                si->flags |= SI_FL_ERR;
                goto out_wakeup;
        }