Commit 3be232f1 authored by Trond Myklebust's avatar Trond Myklebust

SUNRPC: Prevent immediate close+reconnect

If we have already set up the socket and are waiting for it to connect,
then don't immediately close and retry.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent d896ba83
...@@ -767,7 +767,8 @@ EXPORT_SYMBOL_GPL(xprt_disconnect_done); ...@@ -767,7 +767,8 @@ EXPORT_SYMBOL_GPL(xprt_disconnect_done);
*/ */
static void xprt_schedule_autoclose_locked(struct rpc_xprt *xprt) static void xprt_schedule_autoclose_locked(struct rpc_xprt *xprt)
{ {
set_bit(XPRT_CLOSE_WAIT, &xprt->state); if (test_and_set_bit(XPRT_CLOSE_WAIT, &xprt->state))
return;
if (test_and_set_bit(XPRT_LOCKED, &xprt->state) == 0) if (test_and_set_bit(XPRT_LOCKED, &xprt->state) == 0)
queue_work(xprtiod_workqueue, &xprt->task_cleanup); queue_work(xprtiod_workqueue, &xprt->task_cleanup);
else if (xprt->snd_task && !test_bit(XPRT_SND_IS_COOKIE, &xprt->state)) else if (xprt->snd_task && !test_bit(XPRT_SND_IS_COOKIE, &xprt->state))
......
...@@ -2314,7 +2314,7 @@ static void xs_connect(struct rpc_xprt *xprt, struct rpc_task *task) ...@@ -2314,7 +2314,7 @@ 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));
if (transport->sock != NULL) { if (transport->sock != NULL && !xprt_connecting(xprt)) {
dprintk("RPC: xs_connect delayed xprt %p for %lu " dprintk("RPC: xs_connect delayed xprt %p for %lu "
"seconds\n", "seconds\n",
xprt, xprt->reestablish_timeout / HZ); xprt, xprt->reestablish_timeout / HZ);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment