aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2010-09-12 19:55:25 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-09-12 19:55:25 -0400
commit55576244eba805307a2b2b6a145b8f85f8c7c124 (patch)
treeb81f059cd196cdc7b8e0c74bba1584e0c7dfcd5e /net
parent006abe887c5e637d059c44310de6c92f36aded3b (diff)
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>
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/clnt.c84
1 files changed, 42 insertions, 42 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 3a8f53e7ba07..fa5549079d79 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -964,7 +964,48 @@ call_reserveresult(struct rpc_task *task)
964} 964}
965 965
966/* 966/*
967 * 2. Allocate the buffer. For details, see sched.c:rpc_malloc. 967 * 2. Bind and/or refresh the credentials
968 */
969static void
970call_refresh(struct rpc_task *task)
971{
972 dprint_status(task);
973
974 task->tk_action = call_refreshresult;
975 task->tk_status = 0;
976 task->tk_client->cl_stats->rpcauthrefresh++;
977 rpcauth_refreshcred(task);
978}
979
980/*
981 * 2a. Process the results of a credential refresh
982 */
983static void
984call_refreshresult(struct rpc_task *task)
985{
986 int status = task->tk_status;
987
988 dprint_status(task);
989
990 task->tk_status = 0;
991 task->tk_action = call_allocate;
992 if (status >= 0 && rpcauth_uptodatecred(task))
993 return;
994 switch (status) {
995 case -EACCES:
996 rpc_exit(task, -EACCES);
997 return;
998 case -ENOMEM:
999 rpc_exit(task, -ENOMEM);
1000 return;
1001 case -ETIMEDOUT:
1002 rpc_delay(task, 3*HZ);
1003 }
1004 task->tk_action = call_refresh;
1005}
1006
1007/*
1008 * 2b. Allocate the buffer. For details, see sched.c:rpc_malloc.
968 * (Note: buffer memory is freed in xprt_release). 1009 * (Note: buffer memory is freed in xprt_release).
969 */ 1010 */
970static void 1011static void
@@ -1015,47 +1056,6 @@ call_allocate(struct rpc_task *task)
1015 rpc_exit(task, -ERESTARTSYS); 1056 rpc_exit(task, -ERESTARTSYS);
1016} 1057}
1017 1058
1018/*
1019 * 2a. Bind and/or refresh the credentials
1020 */
1021static void
1022call_refresh(struct rpc_task *task)
1023{
1024 dprint_status(task);
1025
1026 task->tk_action = call_refreshresult;
1027 task->tk_status = 0;
1028 task->tk_client->cl_stats->rpcauthrefresh++;
1029 rpcauth_refreshcred(task);
1030}
1031
1032/*
1033 * 2b. Process the results of a credential refresh
1034 */
1035static void
1036call_refreshresult(struct rpc_task *task)
1037{
1038 int status = task->tk_status;
1039
1040 dprint_status(task);
1041
1042 task->tk_status = 0;
1043 task->tk_action = call_allocate;
1044 if (status >= 0 && rpcauth_uptodatecred(task))
1045 return;
1046 switch (status) {
1047 case -EACCES:
1048 rpc_exit(task, -EACCES);
1049 return;
1050 case -ENOMEM:
1051 rpc_exit(task, -ENOMEM);
1052 return;
1053 case -ETIMEDOUT:
1054 rpc_delay(task, 3*HZ);
1055 }
1056 task->tk_action = call_refresh;
1057}
1058
1059static inline int 1059static inline int
1060rpc_task_need_encode(struct rpc_task *task) 1060rpc_task_need_encode(struct rpc_task *task)
1061{ 1061{