[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070222121427.GA29455@2ka.mipt.ru>
Date: Thu, 22 Feb 2007 15:14:27 +0300
From: Evgeniy Polyakov <johnpol@....mipt.ru>
To: David Miller <davem@...emloft.net>
Cc: shemminger@...ux-foundation.org, netdev@...r.kernel.org
Subject: Re: [Bug 8013] New: select for write hangs on a socket after write returned ECONNRESET
On Wed, Feb 21, 2007 at 10:45:43PM -0800, David Miller (davem@...emloft.net) wrote:
> POLLHUP is a complete mess, because it means different things on
> different kinds of fds. And exactly, because it is not maskable,
> this makes it totally useless for sockets.
POLLHUP does show that socket can not be used for transfer, that is what
select() expects to receive. Given select() semantic and the fact, that
socket error is cleared, there is no simple way to say that socket is
not suitable for output - actually not - all reset events ends up with
tcp_done() which marks socket as close, so if in polling time we have
closed socket, it can be considered as error and thus we can add POLLERR
into the mask - so we can extend following code in poll:
if (sk->sk_shutdown == SHUTDOWN_MASK || sk->sk_state == TCP_CLOSE)
mask |= POLLHUP;
to
if (sk->sk_shutdown == SHUTDOWN_MASK || sk->sk_state == TCP_CLOSE)
mask |= POLLHUP | (sk->sk_state == TCP_CLOSE)?POLLERR:0;
Thoughts?
--
Evgeniy Polyakov
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists