aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2015-02-08 16:49:48 -0500
committerTrond Myklebust <trond.myklebust@primarydata.com>2015-02-08 21:47:30 -0500
commitde84d89030fa4efa44c02c96c8b4a8176042c4ff (patch)
treeefa3d6b616d1c117e70456066ba698cc7ae0ea28 /net
parent718ba5b87343df303017585200ee182e937eabfc (diff)
SUNRPC: TCP/UDP always close the old socket before reconnecting
It is not safe to call xs_reset_transport() from inside xs_udp_setup_socket() or xs_tcp_setup_socket(), since they do not own the correct locks. Instead, do it in xs_connect(). Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/xprtsock.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index e57d8ed2c4d8..e53a5ca03daf 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -2081,8 +2081,6 @@ static void xs_udp_setup_socket(struct work_struct *work)
2081 struct socket *sock = transport->sock; 2081 struct socket *sock = transport->sock;
2082 int status = -EIO; 2082 int status = -EIO;
2083 2083
2084 /* Start by resetting any existing state */
2085 xs_reset_transport(transport);
2086 sock = xs_create_sock(xprt, transport, 2084 sock = xs_create_sock(xprt, transport,
2087 xs_addr(xprt)->sa_family, SOCK_DGRAM, 2085 xs_addr(xprt)->sa_family, SOCK_DGRAM,
2088 IPPROTO_UDP, false); 2086 IPPROTO_UDP, false);
@@ -2328,6 +2326,9 @@ static void xs_connect(struct rpc_xprt *xprt, struct rpc_task *task)
2328 2326
2329 WARN_ON_ONCE(!xprt_lock_connect(xprt, task, transport)); 2327 WARN_ON_ONCE(!xprt_lock_connect(xprt, task, transport));
2330 2328
2329 /* Start by resetting any existing state */
2330 xs_reset_transport(transport);
2331
2331 if (transport->sock != NULL && !RPC_IS_SOFTCONN(task)) { 2332 if (transport->sock != NULL && !RPC_IS_SOFTCONN(task)) {
2332 dprintk("RPC: xs_connect delayed xprt %p for %lu " 2333 dprintk("RPC: xs_connect delayed xprt %p for %lu "
2333 "seconds\n", 2334 "seconds\n",