diff options
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r-- | fs/nfs/nfs4proc.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 0b8490eab486..b7babb3b8a4d 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -4936,6 +4936,18 @@ nfs4_init_callback_netid(const struct nfs_client *clp, char *buf, size_t len) | |||
4936 | return scnprintf(buf, len, "tcp"); | 4936 | return scnprintf(buf, len, "tcp"); |
4937 | } | 4937 | } |
4938 | 4938 | ||
4939 | static void nfs4_setclientid_done(struct rpc_task *task, void *calldata) | ||
4940 | { | ||
4941 | struct nfs4_setclientid *sc = calldata; | ||
4942 | |||
4943 | if (task->tk_status == 0) | ||
4944 | sc->sc_cred = get_rpccred(task->tk_rqstp->rq_cred); | ||
4945 | } | ||
4946 | |||
4947 | static const struct rpc_call_ops nfs4_setclientid_ops = { | ||
4948 | .rpc_call_done = nfs4_setclientid_done, | ||
4949 | }; | ||
4950 | |||
4939 | /** | 4951 | /** |
4940 | * nfs4_proc_setclientid - Negotiate client ID | 4952 | * nfs4_proc_setclientid - Negotiate client ID |
4941 | * @clp: state data structure | 4953 | * @clp: state data structure |
@@ -4962,6 +4974,14 @@ int nfs4_proc_setclientid(struct nfs_client *clp, u32 program, | |||
4962 | .rpc_resp = res, | 4974 | .rpc_resp = res, |
4963 | .rpc_cred = cred, | 4975 | .rpc_cred = cred, |
4964 | }; | 4976 | }; |
4977 | struct rpc_task *task; | ||
4978 | struct rpc_task_setup task_setup_data = { | ||
4979 | .rpc_client = clp->cl_rpcclient, | ||
4980 | .rpc_message = &msg, | ||
4981 | .callback_ops = &nfs4_setclientid_ops, | ||
4982 | .callback_data = &setclientid, | ||
4983 | .flags = RPC_TASK_TIMEOUT, | ||
4984 | }; | ||
4965 | int status; | 4985 | int status; |
4966 | 4986 | ||
4967 | /* nfs_client_id4 */ | 4987 | /* nfs_client_id4 */ |
@@ -4988,7 +5008,18 @@ int nfs4_proc_setclientid(struct nfs_client *clp, u32 program, | |||
4988 | dprintk("NFS call setclientid auth=%s, '%.*s'\n", | 5008 | dprintk("NFS call setclientid auth=%s, '%.*s'\n", |
4989 | clp->cl_rpcclient->cl_auth->au_ops->au_name, | 5009 | clp->cl_rpcclient->cl_auth->au_ops->au_name, |
4990 | setclientid.sc_name_len, setclientid.sc_name); | 5010 | setclientid.sc_name_len, setclientid.sc_name); |
4991 | status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); | 5011 | task = rpc_run_task(&task_setup_data); |
5012 | if (IS_ERR(task)) { | ||
5013 | status = PTR_ERR(task); | ||
5014 | goto out; | ||
5015 | } | ||
5016 | status = task->tk_status; | ||
5017 | if (setclientid.sc_cred) { | ||
5018 | clp->cl_acceptor = rpcauth_stringify_acceptor(setclientid.sc_cred); | ||
5019 | put_rpccred(setclientid.sc_cred); | ||
5020 | } | ||
5021 | rpc_put_task(task); | ||
5022 | out: | ||
4992 | trace_nfs4_setclientid(clp, status); | 5023 | trace_nfs4_setclientid(clp, status); |
4993 | dprintk("NFS reply setclientid: %d\n", status); | 5024 | dprintk("NFS reply setclientid: %d\n", status); |
4994 | return status; | 5025 | return status; |