Subject: Re: [Bug 8013] New: select for write hangs on a socket after write returned ECONNRESET

From: Stephen Hemminger <[email-masked]>
Date: Fri, 16 Feb 2007 10:29:14 -0800

On Fri, 16 Feb 2007 19:10:45 +0300
Evgeniy Polyakov <[email-masked]> wrote:

> one of the possible fixes for select() after write() after ECONNRESET.
> 
> Signed-off-by: Evgeniy Polyakov <[email-masked]>
> 
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index b67e0dd..661ca0c 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -365,7 +365,7 @@ unsigned int tcp_poll(struct file *file, struct socket *sock, poll_table *wait)
>  	 * blocking on fresh not-connected or disconnected socket. --ANK
>  	 */
>  	if (sk->sk_shutdown == SHUTDOWN_MASK || sk->sk_state == TCP_CLOSE)
> -		mask |= POLLHUP;
> +		mask |= POLLHUP | POLLERR;
>  	if (sk->sk_shutdown & RCV_SHUTDOWN)
>  		mask |= POLLIN | POLLRDNORM | POLLRDHUP;
>  
> 

No, that would end up setting error bit on normal shutdown. This is incorrect 
behaviour and might even be described in SUSE standard.

There might even be LSB tests on this?

-- 
Stephen Hemminger <[email-masked]>