diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-07-31 14:29:08 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-08-04 08:54:09 -0400 |
commit | a17c2153d2e271b0cbacae9bed83b0eaa41db7e1 (patch) | |
tree | 3c5a73090987278e51aee1a9f185ebe40a00bd65 /net/sunrpc/clnt.c | |
parent | 8572b8e2e3c5f3d990122348c4d2c64dad338611 (diff) |
SUNRPC: Move the bound cred to struct rpc_rqst
This will allow us to save the original generic cred in rpc_message, so
that if we migrate from one server to another, we can generate a new bound
cred without having to punt back to the NFS layer.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/clnt.c')
-rw-r--r-- | net/sunrpc/clnt.c | 91 |
1 files changed, 45 insertions, 46 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index f34b5e3823c0..2388d83b68ff 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -605,8 +605,8 @@ rpc_task_set_rpc_message(struct rpc_task *task, const struct rpc_message *msg) | |||
605 | task->tk_msg.rpc_proc = msg->rpc_proc; | 605 | task->tk_msg.rpc_proc = msg->rpc_proc; |
606 | task->tk_msg.rpc_argp = msg->rpc_argp; | 606 | task->tk_msg.rpc_argp = msg->rpc_argp; |
607 | task->tk_msg.rpc_resp = msg->rpc_resp; | 607 | task->tk_msg.rpc_resp = msg->rpc_resp; |
608 | /* Bind the user cred */ | 608 | if (msg->rpc_cred != NULL) |
609 | task->tk_status = rpcauth_bindcred(task, msg->rpc_cred, task->tk_flags); | 609 | task->tk_msg.rpc_cred = get_rpccred(msg->rpc_cred); |
610 | } | 610 | } |
611 | } | 611 | } |
612 | 612 | ||
@@ -909,11 +909,6 @@ call_reserve(struct rpc_task *task) | |||
909 | { | 909 | { |
910 | dprint_status(task); | 910 | dprint_status(task); |
911 | 911 | ||
912 | if (!rpcauth_uptodatecred(task)) { | ||
913 | task->tk_action = call_refresh; | ||
914 | return; | ||
915 | } | ||
916 | |||
917 | task->tk_status = 0; | 912 | task->tk_status = 0; |
918 | task->tk_action = call_reserveresult; | 913 | task->tk_action = call_reserveresult; |
919 | xprt_reserve(task); | 914 | xprt_reserve(task); |
@@ -977,7 +972,7 @@ call_reserveresult(struct rpc_task *task) | |||
977 | static void | 972 | static void |
978 | call_allocate(struct rpc_task *task) | 973 | call_allocate(struct rpc_task *task) |
979 | { | 974 | { |
980 | unsigned int slack = task->tk_msg.rpc_cred->cr_auth->au_cslack; | 975 | unsigned int slack = task->tk_client->cl_auth->au_cslack; |
981 | struct rpc_rqst *req = task->tk_rqstp; | 976 | struct rpc_rqst *req = task->tk_rqstp; |
982 | struct rpc_xprt *xprt = task->tk_xprt; | 977 | struct rpc_xprt *xprt = task->tk_xprt; |
983 | struct rpc_procinfo *proc = task->tk_msg.rpc_proc; | 978 | struct rpc_procinfo *proc = task->tk_msg.rpc_proc; |
@@ -985,7 +980,7 @@ call_allocate(struct rpc_task *task) | |||
985 | dprint_status(task); | 980 | dprint_status(task); |
986 | 981 | ||
987 | task->tk_status = 0; | 982 | task->tk_status = 0; |
988 | task->tk_action = call_bind; | 983 | task->tk_action = call_refresh; |
989 | 984 | ||
990 | if (req->rq_buffer) | 985 | if (req->rq_buffer) |
991 | return; | 986 | return; |
@@ -1022,6 +1017,47 @@ call_allocate(struct rpc_task *task) | |||
1022 | rpc_exit(task, -ERESTARTSYS); | 1017 | rpc_exit(task, -ERESTARTSYS); |
1023 | } | 1018 | } |
1024 | 1019 | ||
1020 | /* | ||
1021 | * 2a. Bind and/or refresh the credentials | ||
1022 | */ | ||
1023 | static void | ||
1024 | call_refresh(struct rpc_task *task) | ||
1025 | { | ||
1026 | dprint_status(task); | ||
1027 | |||
1028 | task->tk_action = call_refreshresult; | ||
1029 | task->tk_status = 0; | ||
1030 | task->tk_client->cl_stats->rpcauthrefresh++; | ||
1031 | rpcauth_refreshcred(task); | ||
1032 | } | ||
1033 | |||
1034 | /* | ||
1035 | * 2b. Process the results of a credential refresh | ||
1036 | */ | ||
1037 | static void | ||
1038 | call_refreshresult(struct rpc_task *task) | ||
1039 | { | ||
1040 | int status = task->tk_status; | ||
1041 | |||
1042 | dprint_status(task); | ||
1043 | |||
1044 | task->tk_status = 0; | ||
1045 | task->tk_action = call_bind; | ||
1046 | if (status >= 0 && rpcauth_uptodatecred(task)) | ||
1047 | return; | ||
1048 | switch (status) { | ||
1049 | case -EACCES: | ||
1050 | rpc_exit(task, -EACCES); | ||
1051 | return; | ||
1052 | case -ENOMEM: | ||
1053 | rpc_exit(task, -ENOMEM); | ||
1054 | return; | ||
1055 | case -ETIMEDOUT: | ||
1056 | rpc_delay(task, 3*HZ); | ||
1057 | } | ||
1058 | task->tk_action = call_refresh; | ||
1059 | } | ||
1060 | |||
1025 | static inline int | 1061 | static inline int |
1026 | rpc_task_need_encode(struct rpc_task *task) | 1062 | rpc_task_need_encode(struct rpc_task *task) |
1027 | { | 1063 | { |
@@ -1557,43 +1593,6 @@ out_retry: | |||
1557 | } | 1593 | } |
1558 | } | 1594 | } |
1559 | 1595 | ||
1560 | /* | ||
1561 | * 8. Refresh the credentials if rejected by the server | ||
1562 | */ | ||
1563 | static void | ||
1564 | call_refresh(struct rpc_task *task) | ||
1565 | { | ||
1566 | dprint_status(task); | ||
1567 | |||
1568 | task->tk_action = call_refreshresult; | ||
1569 | task->tk_status = 0; | ||
1570 | task->tk_client->cl_stats->rpcauthrefresh++; | ||
1571 | rpcauth_refreshcred(task); | ||
1572 | } | ||
1573 | |||
1574 | /* | ||
1575 | * 8a. Process the results of a credential refresh | ||
1576 | */ | ||
1577 | static void | ||
1578 | call_refreshresult(struct rpc_task *task) | ||
1579 | { | ||
1580 | int status = task->tk_status; | ||
1581 | |||
1582 | dprint_status(task); | ||
1583 | |||
1584 | task->tk_status = 0; | ||
1585 | task->tk_action = call_reserve; | ||
1586 | if (status >= 0 && rpcauth_uptodatecred(task)) | ||
1587 | return; | ||
1588 | if (status == -EACCES) { | ||
1589 | rpc_exit(task, -EACCES); | ||
1590 | return; | ||
1591 | } | ||
1592 | task->tk_action = call_refresh; | ||
1593 | if (status != -ETIMEDOUT) | ||
1594 | rpc_delay(task, 3*HZ); | ||
1595 | } | ||
1596 | |||
1597 | static __be32 * | 1596 | static __be32 * |
1598 | rpc_encode_header(struct rpc_task *task) | 1597 | rpc_encode_header(struct rpc_task *task) |
1599 | { | 1598 | { |