Skip to content

Commit

Permalink
SUNRPC: Simplify socket shutdown when not reusing TCP ports
Browse files Browse the repository at this point in the history
If we're not required to reuse the TCP port, then we can just
immediately close the socket, and leave the cleanup details to the TCP
layer.

Fixes: e6237b6 ("NFSv4.1: Don't rebind to the same source port when reconnecting to the server")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
  • Loading branch information
Trond Myklebust authored and Anna Schumaker committed Aug 27, 2021
1 parent ca7d1d1 commit 0a6ff58
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions net/sunrpc/xprtsock.c
Original file line number Diff line number Diff line change
Expand Up @@ -2099,6 +2099,10 @@ static void xs_tcp_shutdown(struct rpc_xprt *xprt)

if (sock == NULL)
return;
if (!xprt->reuseport) {
xs_close(xprt);
return;
}
switch (skst) {
default:
kernel_sock_shutdown(sock, SHUT_RDWR);
Expand Down

0 comments on commit 0a6ff58

Please sign in to comment.