aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4proc.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2012-07-11 16:30:59 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-07-16 15:12:16 -0400
commit6bbb4ae8ffc4eef825c8742eff1fefae69a82e41 (patch)
tree04fed137757e04a19e0065b9c1441178fcdbe585 /fs/nfs/nfs4proc.c
parentde734831224e74fcaf8917386e33644c4243db95 (diff)
NFS: Clean up nfs4_proc_setclientid() and friends
Add documenting comments and appropriate debugging messages. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r--fs/nfs/nfs4proc.c45
1 files changed, 37 insertions, 8 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 1148081e1a53..05801be4a180 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -4013,6 +4013,16 @@ static void nfs4_init_boot_verifier(const struct nfs_client *clp,
4013 memcpy(bootverf->data, verf, sizeof(bootverf->data)); 4013 memcpy(bootverf->data, verf, sizeof(bootverf->data));
4014} 4014}
4015 4015
4016/**
4017 * nfs4_proc_setclientid - Negotiate client ID
4018 * @clp: state data structure
4019 * @program: RPC program for NFSv4 callback service
4020 * @port: IP port number for NFS4 callback service
4021 * @cred: RPC credential to use for this call
4022 * @res: where to place the result
4023 *
4024 * Returns zero, a negative errno, or a negative NFS4ERR status code.
4025 */
4016int nfs4_proc_setclientid(struct nfs_client *clp, u32 program, 4026int nfs4_proc_setclientid(struct nfs_client *clp, u32 program,
4017 unsigned short port, struct rpc_cred *cred, 4027 unsigned short port, struct rpc_cred *cred,
4018 struct nfs4_setclientid_res *res) 4028 struct nfs4_setclientid_res *res)
@@ -4029,6 +4039,7 @@ int nfs4_proc_setclientid(struct nfs_client *clp, u32 program,
4029 .rpc_resp = res, 4039 .rpc_resp = res,
4030 .rpc_cred = cred, 4040 .rpc_cred = cred,
4031 }; 4041 };
4042 int status;
4032 4043
4033 /* nfs_client_id4 */ 4044 /* nfs_client_id4 */
4034 nfs4_init_boot_verifier(clp, &sc_verifier); 4045 nfs4_init_boot_verifier(clp, &sc_verifier);
@@ -4050,9 +4061,22 @@ int nfs4_proc_setclientid(struct nfs_client *clp, u32 program,
4050 sizeof(setclientid.sc_uaddr), "%s.%u.%u", 4061 sizeof(setclientid.sc_uaddr), "%s.%u.%u",
4051 clp->cl_ipaddr, port >> 8, port & 255); 4062 clp->cl_ipaddr, port >> 8, port & 255);
4052 4063
4053 return rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); 4064 dprintk("NFS call setclientid auth=%s, '%.*s'\n",
4065 clp->cl_rpcclient->cl_auth->au_ops->au_name,
4066 setclientid.sc_name_len, setclientid.sc_name);
4067 status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT);
4068 dprintk("NFS reply setclientid: %d\n", status);
4069 return status;
4054} 4070}
4055 4071
4072/**
4073 * nfs4_proc_setclientid_confirm - Confirm client ID
4074 * @clp: state data structure
4075 * @res: result of a previous SETCLIENTID
4076 * @cred: RPC credential to use for this call
4077 *
4078 * Returns zero, a negative errno, or a negative NFS4ERR status code.
4079 */
4056int nfs4_proc_setclientid_confirm(struct nfs_client *clp, 4080int nfs4_proc_setclientid_confirm(struct nfs_client *clp,
4057 struct nfs4_setclientid_res *arg, 4081 struct nfs4_setclientid_res *arg,
4058 struct rpc_cred *cred) 4082 struct rpc_cred *cred)
@@ -4067,6 +4091,9 @@ int nfs4_proc_setclientid_confirm(struct nfs_client *clp,
4067 unsigned long now; 4091 unsigned long now;
4068 int status; 4092 int status;
4069 4093
4094 dprintk("NFS call setclientid_confirm auth=%s, (client ID %llx)\n",
4095 clp->cl_rpcclient->cl_auth->au_ops->au_name,
4096 clp->cl_clientid);
4070 now = jiffies; 4097 now = jiffies;
4071 status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); 4098 status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT);
4072 if (status == 0) { 4099 if (status == 0) {
@@ -4075,6 +4102,7 @@ int nfs4_proc_setclientid_confirm(struct nfs_client *clp,
4075 clp->cl_last_renewal = now; 4102 clp->cl_last_renewal = now;
4076 spin_unlock(&clp->cl_lock); 4103 spin_unlock(&clp->cl_lock);
4077 } 4104 }
4105 dprintk("NFS reply setclientid_confirm: %d\n", status);
4078 return status; 4106 return status;
4079} 4107}
4080 4108
@@ -5218,6 +5246,8 @@ out:
5218/* 5246/*
5219 * nfs4_proc_exchange_id() 5247 * nfs4_proc_exchange_id()
5220 * 5248 *
5249 * Returns zero, a negative errno, or a negative NFS4ERR status code.
5250 *
5221 * Since the clientid has expired, all compounds using sessions 5251 * Since the clientid has expired, all compounds using sessions
5222 * associated with the stale clientid will be returning 5252 * associated with the stale clientid will be returning
5223 * NFS4ERR_BADSESSION in the sequence operation, and will therefore 5253 * NFS4ERR_BADSESSION in the sequence operation, and will therefore
@@ -5242,15 +5272,14 @@ int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred)
5242 .rpc_cred = cred, 5272 .rpc_cred = cred,
5243 }; 5273 };
5244 5274
5245 dprintk("--> %s\n", __func__);
5246 BUG_ON(clp == NULL);
5247
5248 nfs4_init_boot_verifier(clp, &verifier); 5275 nfs4_init_boot_verifier(clp, &verifier);
5249
5250 args.id_len = scnprintf(args.id, sizeof(args.id), 5276 args.id_len = scnprintf(args.id, sizeof(args.id),
5251 "%s/%s", 5277 "%s/%s",
5252 clp->cl_ipaddr, 5278 clp->cl_ipaddr,
5253 clp->cl_rpcclient->cl_nodename); 5279 clp->cl_rpcclient->cl_nodename);
5280 dprintk("NFS call exchange_id auth=%s, '%.*s'\n",
5281 clp->cl_rpcclient->cl_auth->au_ops->au_name,
5282 args.id_len, args.id);
5254 5283
5255 res.server_owner = kzalloc(sizeof(struct nfs41_server_owner), 5284 res.server_owner = kzalloc(sizeof(struct nfs41_server_owner),
5256 GFP_NOFS); 5285 GFP_NOFS);
@@ -5313,12 +5342,12 @@ out_server_scope:
5313 kfree(res.server_scope); 5342 kfree(res.server_scope);
5314out: 5343out:
5315 if (clp->cl_implid != NULL) 5344 if (clp->cl_implid != NULL)
5316 dprintk("%s: Server Implementation ID: " 5345 dprintk("NFS reply exchange_id: Server Implementation ID: "
5317 "domain: %s, name: %s, date: %llu,%u\n", 5346 "domain: %s, name: %s, date: %llu,%u\n",
5318 __func__, clp->cl_implid->domain, clp->cl_implid->name, 5347 clp->cl_implid->domain, clp->cl_implid->name,
5319 clp->cl_implid->date.seconds, 5348 clp->cl_implid->date.seconds,
5320 clp->cl_implid->date.nseconds); 5349 clp->cl_implid->date.nseconds);
5321 dprintk("<-- %s status= %d\n", __func__, status); 5350 dprintk("NFS reply exchange_id: %d\n", status);
5322 return status; 5351 return status;
5323} 5352}
5324 5353