diff options
-rw-r--r-- | net/sunrpc/clnt.c | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 68ea6dddcf1e..ab8038db8ef8 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -58,7 +58,6 @@ static void call_start(struct rpc_task *task); | |||
58 | static void call_reserve(struct rpc_task *task); | 58 | static void call_reserve(struct rpc_task *task); |
59 | static void call_reserveresult(struct rpc_task *task); | 59 | static void call_reserveresult(struct rpc_task *task); |
60 | static void call_allocate(struct rpc_task *task); | 60 | static void call_allocate(struct rpc_task *task); |
61 | static void call_encode(struct rpc_task *task); | ||
62 | static void call_decode(struct rpc_task *task); | 61 | static void call_decode(struct rpc_task *task); |
63 | static void call_bind(struct rpc_task *task); | 62 | static void call_bind(struct rpc_task *task); |
64 | static void call_bind_status(struct rpc_task *task); | 63 | static void call_bind_status(struct rpc_task *task); |
@@ -70,9 +69,9 @@ static void call_refreshresult(struct rpc_task *task); | |||
70 | static void call_timeout(struct rpc_task *task); | 69 | static void call_timeout(struct rpc_task *task); |
71 | static void call_connect(struct rpc_task *task); | 70 | static void call_connect(struct rpc_task *task); |
72 | static void call_connect_status(struct rpc_task *task); | 71 | static void call_connect_status(struct rpc_task *task); |
73 | static __be32 * call_header(struct rpc_task *task); | ||
74 | static __be32 * call_verify(struct rpc_task *task); | ||
75 | 72 | ||
73 | static __be32 *rpc_encode_header(struct rpc_task *task); | ||
74 | static __be32 *rpc_verify_header(struct rpc_task *task); | ||
76 | static int rpc_ping(struct rpc_clnt *clnt, int flags); | 75 | static int rpc_ping(struct rpc_clnt *clnt, int flags); |
77 | 76 | ||
78 | static void rpc_register_client(struct rpc_clnt *clnt) | 77 | static void rpc_register_client(struct rpc_clnt *clnt) |
@@ -876,7 +875,7 @@ rpc_xdr_buf_init(struct xdr_buf *buf, void *start, size_t len) | |||
876 | * 3. Encode arguments of an RPC call | 875 | * 3. Encode arguments of an RPC call |
877 | */ | 876 | */ |
878 | static void | 877 | static void |
879 | call_encode(struct rpc_task *task) | 878 | rpc_xdr_encode(struct rpc_task *task) |
880 | { | 879 | { |
881 | struct rpc_rqst *req = task->tk_rqstp; | 880 | struct rpc_rqst *req = task->tk_rqstp; |
882 | kxdrproc_t encode; | 881 | kxdrproc_t encode; |
@@ -891,13 +890,14 @@ call_encode(struct rpc_task *task) | |||
891 | (char *)req->rq_buffer + req->rq_callsize, | 890 | (char *)req->rq_buffer + req->rq_callsize, |
892 | req->rq_rcvsize); | 891 | req->rq_rcvsize); |
893 | 892 | ||
894 | /* Encode header and provided arguments */ | 893 | p = rpc_encode_header(task); |
895 | encode = task->tk_msg.rpc_proc->p_encode; | 894 | if (p == NULL) { |
896 | if (!(p = call_header(task))) { | 895 | printk(KERN_INFO "RPC: couldn't encode RPC header, exit EIO\n"); |
897 | printk(KERN_INFO "RPC: call_header failed, exit EIO\n"); | ||
898 | rpc_exit(task, -EIO); | 896 | rpc_exit(task, -EIO); |
899 | return; | 897 | return; |
900 | } | 898 | } |
899 | |||
900 | encode = task->tk_msg.rpc_proc->p_encode; | ||
901 | if (encode == NULL) | 901 | if (encode == NULL) |
902 | return; | 902 | return; |
903 | 903 | ||
@@ -1056,7 +1056,7 @@ call_transmit(struct rpc_task *task) | |||
1056 | /* Encode here so that rpcsec_gss can use correct sequence number. */ | 1056 | /* Encode here so that rpcsec_gss can use correct sequence number. */ |
1057 | if (rpc_task_need_encode(task)) { | 1057 | if (rpc_task_need_encode(task)) { |
1058 | BUG_ON(task->tk_rqstp->rq_bytes_sent != 0); | 1058 | BUG_ON(task->tk_rqstp->rq_bytes_sent != 0); |
1059 | call_encode(task); | 1059 | rpc_xdr_encode(task); |
1060 | /* Did the encode result in an error condition? */ | 1060 | /* Did the encode result in an error condition? */ |
1061 | if (task->tk_status != 0) { | 1061 | if (task->tk_status != 0) { |
1062 | /* Was the error nonfatal? */ | 1062 | /* Was the error nonfatal? */ |
@@ -1240,8 +1240,7 @@ call_decode(struct rpc_task *task) | |||
1240 | goto out_retry; | 1240 | goto out_retry; |
1241 | } | 1241 | } |
1242 | 1242 | ||
1243 | /* Verify the RPC header */ | 1243 | p = rpc_verify_header(task); |
1244 | p = call_verify(task); | ||
1245 | if (IS_ERR(p)) { | 1244 | if (IS_ERR(p)) { |
1246 | if (p == ERR_PTR(-EAGAIN)) | 1245 | if (p == ERR_PTR(-EAGAIN)) |
1247 | goto out_retry; | 1246 | goto out_retry; |
@@ -1259,7 +1258,7 @@ call_decode(struct rpc_task *task) | |||
1259 | return; | 1258 | return; |
1260 | out_retry: | 1259 | out_retry: |
1261 | task->tk_status = 0; | 1260 | task->tk_status = 0; |
1262 | /* Note: call_verify() may have freed the RPC slot */ | 1261 | /* Note: rpc_verify_header() may have freed the RPC slot */ |
1263 | if (task->tk_rqstp == req) { | 1262 | if (task->tk_rqstp == req) { |
1264 | req->rq_received = req->rq_rcv_buf.len = 0; | 1263 | req->rq_received = req->rq_rcv_buf.len = 0; |
1265 | if (task->tk_client->cl_discrtry) | 1264 | if (task->tk_client->cl_discrtry) |
@@ -1306,11 +1305,8 @@ call_refreshresult(struct rpc_task *task) | |||
1306 | return; | 1305 | return; |
1307 | } | 1306 | } |
1308 | 1307 | ||
1309 | /* | ||
1310 | * Call header serialization | ||
1311 | */ | ||
1312 | static __be32 * | 1308 | static __be32 * |
1313 | call_header(struct rpc_task *task) | 1309 | rpc_encode_header(struct rpc_task *task) |
1314 | { | 1310 | { |
1315 | struct rpc_clnt *clnt = task->tk_client; | 1311 | struct rpc_clnt *clnt = task->tk_client; |
1316 | struct rpc_rqst *req = task->tk_rqstp; | 1312 | struct rpc_rqst *req = task->tk_rqstp; |
@@ -1330,11 +1326,8 @@ call_header(struct rpc_task *task) | |||
1330 | return p; | 1326 | return p; |
1331 | } | 1327 | } |
1332 | 1328 | ||
1333 | /* | ||
1334 | * Reply header verification | ||
1335 | */ | ||
1336 | static __be32 * | 1329 | static __be32 * |
1337 | call_verify(struct rpc_task *task) | 1330 | rpc_verify_header(struct rpc_task *task) |
1338 | { | 1331 | { |
1339 | struct kvec *iov = &task->tk_rqstp->rq_rcv_buf.head[0]; | 1332 | struct kvec *iov = &task->tk_rqstp->rq_rcv_buf.head[0]; |
1340 | int len = task->tk_rqstp->rq_rcv_buf.len >> 2; | 1333 | int len = task->tk_rqstp->rq_rcv_buf.len >> 2; |
@@ -1408,7 +1401,7 @@ call_verify(struct rpc_task *task) | |||
1408 | task->tk_action = call_bind; | 1401 | task->tk_action = call_bind; |
1409 | goto out_retry; | 1402 | goto out_retry; |
1410 | case RPC_AUTH_TOOWEAK: | 1403 | case RPC_AUTH_TOOWEAK: |
1411 | printk(KERN_NOTICE "call_verify: server %s requires stronger " | 1404 | printk(KERN_NOTICE "RPC: server %s requires stronger " |
1412 | "authentication.\n", task->tk_client->cl_server); | 1405 | "authentication.\n", task->tk_client->cl_server); |
1413 | break; | 1406 | break; |
1414 | default: | 1407 | default: |