* [PATCH] VSOCK: set POLLOUT | POLLWRNORM for TCP_CLOSING
@ 2018-01-26 11:48 Stefan Hajnoczi
2018-01-26 16:17 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Hajnoczi @ 2018-01-26 11:48 UTC (permalink / raw)
To: netdev; +Cc: Dexuan Cui, Jorgen Hansen, Stefan Hajnoczi
select(2) with wfds but no rfds must return when the socket is shut down
by the peer. This way userspace notices socket activity and gets -EPIPE
from the next write(2).
Currently select(2) does not return for virtio-vsock when a SEND+RCV
shutdown packet is received. This is because vsock_poll() only sets
POLLOUT | POLLWRNORM for TCP_CLOSE, not the TCP_CLOSING state that the
socket is in when the shutdown is received.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
net/vmw_vsock/af_vsock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
index 5d28abf87fbf..c9473d698525 100644
--- a/net/vmw_vsock/af_vsock.c
+++ b/net/vmw_vsock/af_vsock.c
@@ -951,7 +951,7 @@ static unsigned int vsock_poll(struct file *file, struct socket *sock,
* POLLOUT|POLLWRNORM when peer is closed and nothing to read,
* but local send is not shutdown.
*/
- if (sk->sk_state == TCP_CLOSE) {
+ if (sk->sk_state == TCP_CLOSE || sk->sk_state == TCP_CLOSING) {
if (!(sk->sk_shutdown & SEND_SHUTDOWN))
mask |= POLLOUT | POLLWRNORM;
--
2.14.3
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] VSOCK: set POLLOUT | POLLWRNORM for TCP_CLOSING
2018-01-26 11:48 [PATCH] VSOCK: set POLLOUT | POLLWRNORM for TCP_CLOSING Stefan Hajnoczi
@ 2018-01-26 16:17 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-01-26 16:17 UTC (permalink / raw)
To: stefanha; +Cc: netdev, decui, jhansen
From: Stefan Hajnoczi <stefanha@redhat.com>
Date: Fri, 26 Jan 2018 11:48:25 +0000
> select(2) with wfds but no rfds must return when the socket is shut down
> by the peer. This way userspace notices socket activity and gets -EPIPE
> from the next write(2).
>
> Currently select(2) does not return for virtio-vsock when a SEND+RCV
> shutdown packet is received. This is because vsock_poll() only sets
> POLLOUT | POLLWRNORM for TCP_CLOSE, not the TCP_CLOSING state that the
> socket is in when the shutdown is received.
>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Applied and queued up for -stable, thank you.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-01-26 16:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-26 11:48 [PATCH] VSOCK: set POLLOUT | POLLWRNORM for TCP_CLOSING Stefan Hajnoczi
2018-01-26 16:17 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).