Skip to content

Commit a70f3ad

Browse files
Ian Campbellgregkh
authored andcommitted
VSOCK: do not disconnect socket when peer has shutdown SEND only
[ Upstream commit dedc58e ] The peer may be expecting a reply having sent a request and then done a shutdown(SHUT_WR), so tearing down the whole socket at this point seems wrong and breaks for me with a client which does a SHUT_WR. Looking at other socket family's stream_recvmsg callbacks doing a shutdown here does not seem to be the norm and removing it does not seem to have had any adverse effects that I can see. I'm using Stefan's RFC virtio transport patches, I'm unsure of the impact on the vmci transport. Signed-off-by: Ian Campbell <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Stefan Hajnoczi <[email protected]> Cc: Claudio Imbrenda <[email protected]> Cc: Andy King <[email protected]> Cc: Dmitry Torokhov <[email protected]> Cc: Jorgen Hansen <[email protected]> Cc: Adit Ranadive <[email protected]> Cc: [email protected] Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent c1e7976 commit a70f3ad

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

net/vmw_vsock/af_vsock.c

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,27 +1796,8 @@ vsock_stream_recvmsg(struct kiocb *kiocb,
17961796
else if (sk->sk_shutdown & RCV_SHUTDOWN)
17971797
err = 0;
17981798

1799-
if (copied > 0) {
1800-
/* We only do these additional bookkeeping/notification steps
1801-
* if we actually copied something out of the queue pair
1802-
* instead of just peeking ahead.
1803-
*/
1804-
1805-
if (!(flags & MSG_PEEK)) {
1806-
/* If the other side has shutdown for sending and there
1807-
* is nothing more to read, then modify the socket
1808-
* state.
1809-
*/
1810-
if (vsk->peer_shutdown & SEND_SHUTDOWN) {
1811-
if (vsock_stream_has_data(vsk) <= 0) {
1812-
sk->sk_state = SS_UNCONNECTED;
1813-
sock_set_flag(sk, SOCK_DONE);
1814-
sk->sk_state_change(sk);
1815-
}
1816-
}
1817-
}
1799+
if (copied > 0)
18181800
err = copied;
1819-
}
18201801

18211802
out_wait:
18221803
finish_wait(sk_sleep(sk), &wait);

0 commit comments

Comments
 (0)