diff mbox series

[3/3] SUNRPC: Initiate a connection close on an ESHUTDOWN error in stream receive

Message ID 20190219162202.68013-3-trond.myklebust@hammerspace.com (mailing list archive)
State New, archived
Headers show
Series [1/3] SUNRPC: Don't suppress socket errors when a message read completes | expand

Commit Message

Trond Myklebust Feb. 19, 2019, 4:22 p.m. UTC
If the client stream receive code receives an ESHUTDOWN error either
because the server closed the connection, or because it sent a
callback which cannot be processed, then we should shut down
the connection.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
 net/sunrpc/xprtsock.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 89bcab53848a..618e9c255a9f 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -694,7 +694,10 @@  static void xs_stream_data_receive(struct sock_xprt *transport)
 		read += ret;
 		cond_resched();
 	}
-	xs_poll_check_readable(transport);
+	if (ret == -ESHUTDOWN)
+		kernel_sock_shutdown(transport->sock, SHUT_RDWR);
+	else
+		xs_poll_check_readable(transport);
 out:
 	mutex_unlock(&transport->recv_mutex);
 	trace_xs_stream_read_data(&transport->xprt, ret, read);