From 5f52a9d429b8ba8f9d669730adf16bc534eb74ea Mon Sep 17 00:00:00 2001 From: Trond Myklebust Date: Sat, 16 Feb 2019 09:31:47 -0500 Subject: [PATCH] SUNRPC: Initiate a connection close on an ESHUTDOWN error in stream receive 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 --- net/sunrpc/xprtsock.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index e51716e88899..a3aadc04808f 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c @@ -705,7 +705,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);