aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/clnt.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2006-01-03 03:55:03 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-01-06 14:58:39 -0500
commitabbcf28f23d53e8ec56a91f3528743913fa2694a (patch)
tree97dafc3840e4660ac0fcf99bbdc7eddc2fecd08a /net/sunrpc/clnt.c
parentabd3e641d5ef9f836ab2f2b04d80b8619b051531 (diff)
SUNRPC: Yet more RPC cleanups
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/clnt.c')
-rw-r--r--net/sunrpc/clnt.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 61c3abeaccae..6ab4cbd8a901 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -511,7 +511,7 @@ rpc_call_setup(struct rpc_task *task, struct rpc_message *msg, int flags)
511 if (task->tk_status == 0) 511 if (task->tk_status == 0)
512 task->tk_action = call_start; 512 task->tk_action = call_start;
513 else 513 else
514 task->tk_action = NULL; 514 task->tk_action = rpc_exit_task;
515} 515}
516 516
517void 517void
@@ -892,7 +892,7 @@ call_transmit(struct rpc_task *task)
892 if (task->tk_status < 0) 892 if (task->tk_status < 0)
893 return; 893 return;
894 if (!task->tk_msg.rpc_proc->p_decode) { 894 if (!task->tk_msg.rpc_proc->p_decode) {
895 task->tk_action = NULL; 895 task->tk_action = rpc_exit_task;
896 rpc_wake_up_task(task); 896 rpc_wake_up_task(task);
897 } 897 }
898 return; 898 return;
@@ -1039,13 +1039,14 @@ call_decode(struct rpc_task *task)
1039 sizeof(req->rq_rcv_buf)) != 0); 1039 sizeof(req->rq_rcv_buf)) != 0);
1040 1040
1041 /* Verify the RPC header */ 1041 /* Verify the RPC header */
1042 if (!(p = call_verify(task))) { 1042 p = call_verify(task);
1043 if (task->tk_action == NULL) 1043 if (IS_ERR(p)) {
1044 return; 1044 if (p == ERR_PTR(-EAGAIN))
1045 goto out_retry; 1045 goto out_retry;
1046 return;
1046 } 1047 }
1047 1048
1048 task->tk_action = NULL; 1049 task->tk_action = rpc_exit_task;
1049 1050
1050 if (decode) 1051 if (decode)
1051 task->tk_status = rpcauth_unwrap_resp(task, decode, req, p, 1052 task->tk_status = rpcauth_unwrap_resp(task, decode, req, p,
@@ -1138,7 +1139,7 @@ call_verify(struct rpc_task *task)
1138 1139
1139 if ((n = ntohl(*p++)) != RPC_REPLY) { 1140 if ((n = ntohl(*p++)) != RPC_REPLY) {
1140 printk(KERN_WARNING "call_verify: not an RPC reply: %x\n", n); 1141 printk(KERN_WARNING "call_verify: not an RPC reply: %x\n", n);
1141 goto out_retry; 1142 goto out_garbage;
1142 } 1143 }
1143 if ((n = ntohl(*p++)) != RPC_MSG_ACCEPTED) { 1144 if ((n = ntohl(*p++)) != RPC_MSG_ACCEPTED) {
1144 if (--len < 0) 1145 if (--len < 0)
@@ -1168,7 +1169,7 @@ call_verify(struct rpc_task *task)
1168 task->tk_pid); 1169 task->tk_pid);
1169 rpcauth_invalcred(task); 1170 rpcauth_invalcred(task);
1170 task->tk_action = call_refresh; 1171 task->tk_action = call_refresh;
1171 return NULL; 1172 goto out_retry;
1172 case RPC_AUTH_BADCRED: 1173 case RPC_AUTH_BADCRED:
1173 case RPC_AUTH_BADVERF: 1174 case RPC_AUTH_BADVERF:
1174 /* possibly garbled cred/verf? */ 1175 /* possibly garbled cred/verf? */
@@ -1178,7 +1179,7 @@ call_verify(struct rpc_task *task)
1178 dprintk("RPC: %4d call_verify: retry garbled creds\n", 1179 dprintk("RPC: %4d call_verify: retry garbled creds\n",
1179 task->tk_pid); 1180 task->tk_pid);
1180 task->tk_action = call_bind; 1181 task->tk_action = call_bind;
1181 return NULL; 1182 goto out_retry;
1182 case RPC_AUTH_TOOWEAK: 1183 case RPC_AUTH_TOOWEAK:
1183 printk(KERN_NOTICE "call_verify: server requires stronger " 1184 printk(KERN_NOTICE "call_verify: server requires stronger "
1184 "authentication.\n"); 1185 "authentication.\n");
@@ -1193,7 +1194,7 @@ call_verify(struct rpc_task *task)
1193 } 1194 }
1194 if (!(p = rpcauth_checkverf(task, p))) { 1195 if (!(p = rpcauth_checkverf(task, p))) {
1195 printk(KERN_WARNING "call_verify: auth check failed\n"); 1196 printk(KERN_WARNING "call_verify: auth check failed\n");
1196 goto out_retry; /* bad verifier, retry */ 1197 goto out_garbage; /* bad verifier, retry */
1197 } 1198 }
1198 len = p - (u32 *)iov->iov_base - 1; 1199 len = p - (u32 *)iov->iov_base - 1;
1199 if (len < 0) 1200 if (len < 0)
@@ -1230,23 +1231,24 @@ call_verify(struct rpc_task *task)
1230 /* Also retry */ 1231 /* Also retry */
1231 } 1232 }
1232 1233
1233out_retry: 1234out_garbage:
1234 task->tk_client->cl_stats->rpcgarbage++; 1235 task->tk_client->cl_stats->rpcgarbage++;
1235 if (task->tk_garb_retry) { 1236 if (task->tk_garb_retry) {
1236 task->tk_garb_retry--; 1237 task->tk_garb_retry--;
1237 dprintk("RPC %s: retrying %4d\n", __FUNCTION__, task->tk_pid); 1238 dprintk("RPC %s: retrying %4d\n", __FUNCTION__, task->tk_pid);
1238 task->tk_action = call_bind; 1239 task->tk_action = call_bind;
1239 return NULL; 1240out_retry:
1241 return ERR_PTR(-EAGAIN);
1240 } 1242 }
1241 printk(KERN_WARNING "RPC %s: retry failed, exit EIO\n", __FUNCTION__); 1243 printk(KERN_WARNING "RPC %s: retry failed, exit EIO\n", __FUNCTION__);
1242out_eio: 1244out_eio:
1243 error = -EIO; 1245 error = -EIO;
1244out_err: 1246out_err:
1245 rpc_exit(task, error); 1247 rpc_exit(task, error);
1246 return NULL; 1248 return ERR_PTR(error);
1247out_overflow: 1249out_overflow:
1248 printk(KERN_WARNING "RPC %s: server reply was truncated.\n", __FUNCTION__); 1250 printk(KERN_WARNING "RPC %s: server reply was truncated.\n", __FUNCTION__);
1249 goto out_retry; 1251 goto out_garbage;
1250} 1252}
1251 1253
1252static int rpcproc_encode_null(void *rqstp, u32 *data, void *obj) 1254static int rpcproc_encode_null(void *rqstp, u32 *data, void *obj)