aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2006-08-31 15:44:52 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-09-22 23:25:00 -0400
commitda45828e2835057045150b318c4fbe9bb91f18dd (patch)
treeb04b3ae7fe4cf79c8af2f399f44d5db65995ac55 /net
parent76303992b4701124f4cd0791ae2049ab4332f02c (diff)
SUNRPC: Clean up soft task error handling
- Ensure that the task aborts the RPC call only when it has actually timed out. - Ensure that req->rq_majortimeo is initialised correctly. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/clnt.c34
-rw-r--r--net/sunrpc/xprt.c8
2 files changed, 15 insertions, 27 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 355e7863c0aa..ceadb728f0da 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -863,15 +863,11 @@ call_bind_status(struct rpc_task *task)
863 dprintk("RPC: %4d remote rpcbind: RPC program/version unavailable\n", 863 dprintk("RPC: %4d remote rpcbind: RPC program/version unavailable\n",
864 task->tk_pid); 864 task->tk_pid);
865 rpc_delay(task, 3*HZ); 865 rpc_delay(task, 3*HZ);
866 goto retry_bind; 866 goto retry_timeout;
867 case -ETIMEDOUT: 867 case -ETIMEDOUT:
868 dprintk("RPC: %4d rpcbind request timed out\n", 868 dprintk("RPC: %4d rpcbind request timed out\n",
869 task->tk_pid); 869 task->tk_pid);
870 if (RPC_IS_SOFT(task)) { 870 goto retry_timeout;
871 status = -EIO;
872 break;
873 }
874 goto retry_bind;
875 case -EPFNOSUPPORT: 871 case -EPFNOSUPPORT:
876 dprintk("RPC: %4d remote rpcbind service unavailable\n", 872 dprintk("RPC: %4d remote rpcbind service unavailable\n",
877 task->tk_pid); 873 task->tk_pid);
@@ -884,16 +880,13 @@ call_bind_status(struct rpc_task *task)
884 dprintk("RPC: %4d unrecognized rpcbind error (%d)\n", 880 dprintk("RPC: %4d unrecognized rpcbind error (%d)\n",
885 task->tk_pid, -task->tk_status); 881 task->tk_pid, -task->tk_status);
886 status = -EIO; 882 status = -EIO;
887 break;
888 } 883 }
889 884
890 rpc_exit(task, status); 885 rpc_exit(task, status);
891 return; 886 return;
892 887
893retry_bind: 888retry_timeout:
894 task->tk_status = 0; 889 task->tk_action = call_timeout;
895 task->tk_action = call_bind;
896 return;
897} 890}
898 891
899/* 892/*
@@ -941,14 +934,16 @@ call_connect_status(struct rpc_task *task)
941 934
942 switch (status) { 935 switch (status) {
943 case -ENOTCONN: 936 case -ENOTCONN:
944 case -ETIMEDOUT:
945 case -EAGAIN: 937 case -EAGAIN:
946 task->tk_action = call_bind; 938 task->tk_action = call_bind;
947 break; 939 if (!RPC_IS_SOFT(task))
948 default: 940 return;
949 rpc_exit(task, -EIO); 941 /* if soft mounted, test if we've timed out */
950 break; 942 case -ETIMEDOUT:
943 task->tk_action = call_timeout;
944 return;
951 } 945 }
946 rpc_exit(task, -EIO);
952} 947}
953 948
954/* 949/*
@@ -1057,7 +1052,6 @@ call_status(struct rpc_task *task)
1057 printk("%s: RPC call returned error %d\n", 1052 printk("%s: RPC call returned error %d\n",
1058 clnt->cl_protname, -status); 1053 clnt->cl_protname, -status);
1059 rpc_exit(task, status); 1054 rpc_exit(task, status);
1060 break;
1061 } 1055 }
1062} 1056}
1063 1057
@@ -1125,10 +1119,10 @@ call_decode(struct rpc_task *task)
1125 clnt->cl_stats->rpcretrans++; 1119 clnt->cl_stats->rpcretrans++;
1126 goto out_retry; 1120 goto out_retry;
1127 } 1121 }
1128 printk(KERN_WARNING "%s: too small RPC reply size (%d bytes)\n", 1122 dprintk("%s: too small RPC reply size (%d bytes)\n",
1129 clnt->cl_protname, task->tk_status); 1123 clnt->cl_protname, task->tk_status);
1130 rpc_exit(task, -EIO); 1124 task->tk_action = call_timeout;
1131 return; 1125 goto out_retry;
1132 } 1126 }
1133 1127
1134 /* 1128 /*
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index e4f64fb58ff2..a85f82baefc1 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -585,13 +585,6 @@ static void xprt_connect_status(struct rpc_task *task)
585 task->tk_pid, -task->tk_status, task->tk_client->cl_server); 585 task->tk_pid, -task->tk_status, task->tk_client->cl_server);
586 xprt_release_write(xprt, task); 586 xprt_release_write(xprt, task);
587 task->tk_status = -EIO; 587 task->tk_status = -EIO;
588 return;
589 }
590
591 /* if soft mounted, just cause this RPC to fail */
592 if (RPC_IS_SOFT(task)) {
593 xprt_release_write(xprt, task);
594 task->tk_status = -EIO;
595 } 588 }
596} 589}
597 590
@@ -829,6 +822,7 @@ static void xprt_request_init(struct rpc_task *task, struct rpc_xprt *xprt)
829 req->rq_bufsize = 0; 822 req->rq_bufsize = 0;
830 req->rq_xid = xprt_alloc_xid(xprt); 823 req->rq_xid = xprt_alloc_xid(xprt);
831 req->rq_release_snd_buf = NULL; 824 req->rq_release_snd_buf = NULL;
825 xprt_reset_majortimeo(req);
832 dprintk("RPC: %4d reserved req %p xid %08x\n", task->tk_pid, 826 dprintk("RPC: %4d reserved req %p xid %08x\n", task->tk_pid,
833 req, ntohl(req->rq_xid)); 827 req, ntohl(req->rq_xid));
834} 828}