Commit 1afeaf5c authored by Trond Myklebust's avatar Trond Myklebust

sunrpc: fix loss of task->tk_status after rpc_delay call in xprt_alloc_slot

xprt_alloc_slot will call rpc_delay() to make the task wait a bit before
retrying when it gets back an -ENOMEM error from xprt_dynamic_alloc_slot.
The problem is that rpc_delay will clear the task->tk_status, causing
call_reserveresult to abort the task.

The solution is simply to let call_reserveresult handle the ENOMEM error
directly.
Reported-by: default avatarJeff Layton <jlayton@redhat.com>
Cc: stable@vger.kernel.org [>= 3.1]
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 6b343099
...@@ -1288,6 +1288,8 @@ call_reserveresult(struct rpc_task *task) ...@@ -1288,6 +1288,8 @@ call_reserveresult(struct rpc_task *task)
} }
switch (status) { switch (status) {
case -ENOMEM:
rpc_delay(task, HZ >> 2);
case -EAGAIN: /* woken up; retry */ case -EAGAIN: /* woken up; retry */
task->tk_action = call_reserve; task->tk_action = call_reserve;
return; return;
......
...@@ -984,15 +984,16 @@ static void xprt_alloc_slot(struct rpc_task *task) ...@@ -984,15 +984,16 @@ static void xprt_alloc_slot(struct rpc_task *task)
goto out_init_req; goto out_init_req;
switch (PTR_ERR(req)) { switch (PTR_ERR(req)) {
case -ENOMEM: case -ENOMEM:
rpc_delay(task, HZ >> 2);
dprintk("RPC: dynamic allocation of request slot " dprintk("RPC: dynamic allocation of request slot "
"failed! Retrying\n"); "failed! Retrying\n");
task->tk_status = -ENOMEM;
break; break;
case -EAGAIN: case -EAGAIN:
rpc_sleep_on(&xprt->backlog, task, NULL); rpc_sleep_on(&xprt->backlog, task, NULL);
dprintk("RPC: waiting for request slot\n"); dprintk("RPC: waiting for request slot\n");
default:
task->tk_status = -EAGAIN;
} }
task->tk_status = -EAGAIN;
return; return;
out_init_req: out_init_req:
task->tk_status = 0; task->tk_status = 0;
......
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