提交 8d373da6 编写于 作者: T Trond Myklebust 提交者: Yang Yingliang

SUNRPC: Don't let RPC_SOFTCONN tasks time out if the transport is connected

mainline inclusion
from mainline-5.1-rc3
commit d84dd3fb
category: bugfix
bugzilla: 51818
CVE: NA

-------------------------------------------------

If the transport is still connected, then we do want to allow
RPC_SOFTCONN tasks to retry. They should time out if and only if
the connection is broken.
Signed-off-by: NTrond Myklebust <trond.myklebust@hammerspace.com>
Conflicts:
	net/sunrpc/clnt.c
Signed-off-by: NZhang Changzhong <zhangchangzhong@huawei.com>
Reviewed-by: NHou Tao <houtao1@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 558f5b03
...@@ -2196,6 +2196,15 @@ call_status(struct rpc_task *task) ...@@ -2196,6 +2196,15 @@ call_status(struct rpc_task *task)
} }
} }
static bool
rpc_check_connected(const struct rpc_rqst *req)
{
/* No allocated request or transport? return true */
if (!req || !req->rq_xprt)
return true;
return xprt_connected(req->rq_xprt);
}
/* /*
* 6a. Handle RPC timeout * 6a. Handle RPC timeout
* We do not release the request slot, so we keep using the * We do not release the request slot, so we keep using the
...@@ -2214,10 +2223,11 @@ call_timeout(struct rpc_task *task) ...@@ -2214,10 +2223,11 @@ call_timeout(struct rpc_task *task)
dprintk("RPC: %5u call_timeout (major)\n", task->tk_pid); dprintk("RPC: %5u call_timeout (major)\n", task->tk_pid);
task->tk_timeouts++; task->tk_timeouts++;
if (RPC_IS_SOFTCONN(task)) { if (RPC_IS_SOFTCONN(task) && !rpc_check_connected(task->tk_rqstp)) {
rpc_exit(task, -ETIMEDOUT); rpc_exit(task, -ETIMEDOUT);
return; return;
} }
if (RPC_IS_SOFT(task)) { if (RPC_IS_SOFT(task)) {
if (clnt->cl_chatty) { if (clnt->cl_chatty) {
printk(KERN_NOTICE "%s: server %s not responding, timed out\n", printk(KERN_NOTICE "%s: server %s not responding, timed out\n",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册