Skip to content

Commit 1afeaf5

Browse files
Trond MyklebustTrond Myklebust
authored andcommitted
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: Jeff Layton <jlayton@redhat.com> Cc: stable@vger.kernel.org [>= 3.1] Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
1 parent 6b34309 commit 1afeaf5

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

‎net/sunrpc/clnt.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,6 +1288,8 @@ call_reserveresult(struct rpc_task *task)
12881288
}
12891289

12901290
switch (status) {
1291+
case -ENOMEM:
1292+
rpc_delay(task, HZ >> 2);
12911293
case -EAGAIN: /* woken up; retry */
12921294
task->tk_action = call_reserve;
12931295
return;

‎net/sunrpc/xprt.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -984,15 +984,16 @@ static void xprt_alloc_slot(struct rpc_task *task)
984984
goto out_init_req;
985985
switch (PTR_ERR(req)) {
986986
case -ENOMEM:
987-
rpc_delay(task, HZ >> 2);
988987
dprintk("RPC: dynamic allocation of request slot "
989988
"failed! Retrying\n");
989+
task->tk_status = -ENOMEM;
990990
break;
991991
case -EAGAIN:
992992
rpc_sleep_on(&xprt->backlog, task, NULL);
993993
dprintk("RPC: waiting for request slot\n");
994+
default:
995+
task->tk_status = -EAGAIN;
994996
}
995-
task->tk_status = -EAGAIN;
996997
return;
997998
out_init_req:
998999
task->tk_status = 0;

0 commit comments

Comments
 (0)