Commit 283eb003 authored by Trond Myklebust's avatar Trond Myklebust

RPC: Ensure that if we reconnect, we delay by at least 15

     seconds in order to avoid flooding of servers.
parent 3cab1c95
...@@ -537,8 +537,17 @@ void xprt_connect(struct rpc_task *task) ...@@ -537,8 +537,17 @@ void xprt_connect(struct rpc_task *task)
task->tk_timeout = RPC_CONNECT_TIMEOUT; task->tk_timeout = RPC_CONNECT_TIMEOUT;
rpc_sleep_on(&xprt->pending, task, xprt_connect_status, NULL); rpc_sleep_on(&xprt->pending, task, xprt_connect_status, NULL);
if (!test_and_set_bit(XPRT_CONNECTING, &xprt->sockstate)) if (!test_and_set_bit(XPRT_CONNECTING, &xprt->sockstate)) {
/* Note: if we are here due to a dropped connection
* we delay reconnecting by RPC_REESTABLISH_TIMEOUT/HZ
* seconds
*/
if (xprt->sock != NULL)
schedule_delayed_work(&xprt->sock_connect,
RPC_REESTABLISH_TIMEOUT);
else
schedule_work(&xprt->sock_connect); schedule_work(&xprt->sock_connect);
}
return; return;
out_write: out_write:
xprt_release_write(xprt, task); xprt_release_write(xprt, task);
...@@ -566,7 +575,6 @@ xprt_connect_status(struct rpc_task *task) ...@@ -566,7 +575,6 @@ xprt_connect_status(struct rpc_task *task)
case -ECONNREFUSED: case -ECONNREFUSED:
case -ECONNRESET: case -ECONNRESET:
case -ENOTCONN: case -ENOTCONN:
rpc_delay(task, RPC_REESTABLISH_TIMEOUT);
return; return;
case -ETIMEDOUT: case -ETIMEDOUT:
dprintk("RPC: %4d xprt_connect_status: timed out\n", dprintk("RPC: %4d xprt_connect_status: timed out\n",
......
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