提交 de84d890 编写于 作者: T Trond Myklebust

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: NTrond Myklebust <trond.myklebust@primarydata.com>
上级 718ba5b8
...@@ -2081,8 +2081,6 @@ static void xs_udp_setup_socket(struct work_struct *work) ...@@ -2081,8 +2081,6 @@ static void xs_udp_setup_socket(struct work_struct *work)
struct socket *sock = transport->sock; struct socket *sock = transport->sock;
int status = -EIO; int status = -EIO;
/* Start by resetting any existing state */
xs_reset_transport(transport);
sock = xs_create_sock(xprt, transport, sock = xs_create_sock(xprt, transport,
xs_addr(xprt)->sa_family, SOCK_DGRAM, xs_addr(xprt)->sa_family, SOCK_DGRAM,
IPPROTO_UDP, false); IPPROTO_UDP, false);
...@@ -2328,6 +2326,9 @@ static void xs_connect(struct rpc_xprt *xprt, struct rpc_task *task) ...@@ -2328,6 +2326,9 @@ static void xs_connect(struct rpc_xprt *xprt, struct rpc_task *task)
WARN_ON_ONCE(!xprt_lock_connect(xprt, task, transport)); WARN_ON_ONCE(!xprt_lock_connect(xprt, task, transport));
/* Start by resetting any existing state */
xs_reset_transport(transport);
if (transport->sock != NULL && !RPC_IS_SOFTCONN(task)) { if (transport->sock != NULL && !RPC_IS_SOFTCONN(task)) {
dprintk("RPC: xs_connect delayed xprt %p for %lu " dprintk("RPC: xs_connect delayed xprt %p for %lu "
"seconds\n", "seconds\n",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册