SUNRPC: cleanup state-machine ordering
This is just a minor cleanup: net/sunrpc/clnt.c clarifies the rpc client state machine by commenting each state and by laying out the functions implementing each state in the order that each state is normally executed (in the absence of errors). The previous patch "Fix null dereference in call_allocate" changed the order of the states. Move the functions and update the comments to reflect the change. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
parent
006abe887c
commit
55576244eb
1 changed files with 42 additions and 42 deletions
|
@ -964,7 +964,48 @@ call_reserveresult(struct rpc_task *task)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 2. Allocate the buffer. For details, see sched.c:rpc_malloc.
|
* 2. Bind and/or refresh the credentials
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
call_refresh(struct rpc_task *task)
|
||||||
|
{
|
||||||
|
dprint_status(task);
|
||||||
|
|
||||||
|
task->tk_action = call_refreshresult;
|
||||||
|
task->tk_status = 0;
|
||||||
|
task->tk_client->cl_stats->rpcauthrefresh++;
|
||||||
|
rpcauth_refreshcred(task);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 2a. Process the results of a credential refresh
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
call_refreshresult(struct rpc_task *task)
|
||||||
|
{
|
||||||
|
int status = task->tk_status;
|
||||||
|
|
||||||
|
dprint_status(task);
|
||||||
|
|
||||||
|
task->tk_status = 0;
|
||||||
|
task->tk_action = call_allocate;
|
||||||
|
if (status >= 0 && rpcauth_uptodatecred(task))
|
||||||
|
return;
|
||||||
|
switch (status) {
|
||||||
|
case -EACCES:
|
||||||
|
rpc_exit(task, -EACCES);
|
||||||
|
return;
|
||||||
|
case -ENOMEM:
|
||||||
|
rpc_exit(task, -ENOMEM);
|
||||||
|
return;
|
||||||
|
case -ETIMEDOUT:
|
||||||
|
rpc_delay(task, 3*HZ);
|
||||||
|
}
|
||||||
|
task->tk_action = call_refresh;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 2b. Allocate the buffer. For details, see sched.c:rpc_malloc.
|
||||||
* (Note: buffer memory is freed in xprt_release).
|
* (Note: buffer memory is freed in xprt_release).
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
|
@ -1015,47 +1056,6 @@ call_allocate(struct rpc_task *task)
|
||||||
rpc_exit(task, -ERESTARTSYS);
|
rpc_exit(task, -ERESTARTSYS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* 2a. Bind and/or refresh the credentials
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
call_refresh(struct rpc_task *task)
|
|
||||||
{
|
|
||||||
dprint_status(task);
|
|
||||||
|
|
||||||
task->tk_action = call_refreshresult;
|
|
||||||
task->tk_status = 0;
|
|
||||||
task->tk_client->cl_stats->rpcauthrefresh++;
|
|
||||||
rpcauth_refreshcred(task);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 2b. Process the results of a credential refresh
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
call_refreshresult(struct rpc_task *task)
|
|
||||||
{
|
|
||||||
int status = task->tk_status;
|
|
||||||
|
|
||||||
dprint_status(task);
|
|
||||||
|
|
||||||
task->tk_status = 0;
|
|
||||||
task->tk_action = call_allocate;
|
|
||||||
if (status >= 0 && rpcauth_uptodatecred(task))
|
|
||||||
return;
|
|
||||||
switch (status) {
|
|
||||||
case -EACCES:
|
|
||||||
rpc_exit(task, -EACCES);
|
|
||||||
return;
|
|
||||||
case -ENOMEM:
|
|
||||||
rpc_exit(task, -ENOMEM);
|
|
||||||
return;
|
|
||||||
case -ETIMEDOUT:
|
|
||||||
rpc_delay(task, 3*HZ);
|
|
||||||
}
|
|
||||||
task->tk_action = call_refresh;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
rpc_task_need_encode(struct rpc_task *task)
|
rpc_task_need_encode(struct rpc_task *task)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue