Skip to content

Commit

Permalink
SUNRPC: RPC level errors should always set task->tk_rpc_status
Browse files Browse the repository at this point in the history
Ensure that we set task->tk_rpc_status for all RPC level errors so that
the caller can distinguish between those and server reply status errors.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
  • Loading branch information
Trond Myklebust authored and Anna Schumaker committed Sep 17, 2019
1 parent 45835a6 commit 714fbc7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions net/sunrpc/clnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1837,7 +1837,7 @@ call_allocate(struct rpc_task *task)
return;
}

rpc_exit(task, -ERESTARTSYS);
rpc_call_rpcerror(task, -ERESTARTSYS);
}

static int
Expand Down Expand Up @@ -2544,7 +2544,7 @@ rpc_encode_header(struct rpc_task *task, struct xdr_stream *xdr)
return 0;
out_fail:
trace_rpc_bad_callhdr(task);
rpc_exit(task, error);
rpc_call_rpcerror(task, error);
return error;
}

Expand Down Expand Up @@ -2611,7 +2611,7 @@ rpc_decode_header(struct rpc_task *task, struct xdr_stream *xdr)
return -EAGAIN;
}
out_err:
rpc_exit(task, error);
rpc_call_rpcerror(task, error);
return error;

out_unparsable:
Expand Down
5 changes: 4 additions & 1 deletion net/sunrpc/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -911,8 +911,10 @@ static void __rpc_execute(struct rpc_task *task)
/*
* Signalled tasks should exit rather than sleep.
*/
if (RPC_SIGNALLED(task))
if (RPC_SIGNALLED(task)) {
task->tk_rpc_status = -ERESTARTSYS;
rpc_exit(task, -ERESTARTSYS);
}

/*
* The queue->lock protects against races with
Expand Down Expand Up @@ -948,6 +950,7 @@ static void __rpc_execute(struct rpc_task *task)
*/
dprintk("RPC: %5u got signal\n", task->tk_pid);
set_bit(RPC_TASK_SIGNALLED, &task->tk_runstate);
task->tk_rpc_status = -ERESTARTSYS;
rpc_exit(task, -ERESTARTSYS);
}
dprintk("RPC: %5u sync task resuming\n", task->tk_pid);
Expand Down

0 comments on commit 714fbc7

Please sign in to comment.