aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAndy Adamson <andros@netapp.com>2009-04-01 09:22:46 -0400
committerBenny Halevy <bhalevy@panasas.com>2009-06-17 15:25:11 -0400
commita7b721037f898b29a8083da59b1dccd3da385b07 (patch)
tree57d0fba7528118a9d4dcd8395adbdb91956fcb17 /fs
parent8e69514f2981d85108c2bd220ff8e188c0c27cdb (diff)
nfs41: introduce get_state_renewal_cred
Use the machine cred for sending SEQUENCE to renew the client's lease. [revamp patch for new state management design starting 2.6.29] [nfs41: support minorversion 1 for nfs4_check_lease] Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: get cred in exchange_id when cred arg is NULL] Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: use cl_machined_cred instead of cl_ex_cred] Since EXCHANGE_ID insists on using the machine credential, cl_ex_cred is not needed. nfs4_proc_exchange_id() is only called if the machine credential is available. Remove the credential logic from nfs4_proc_exchange_id. Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/nfs4_fs.h5
-rw-r--r--fs/nfs/nfs4proc.c3
-rw-r--r--fs/nfs/nfs4renewd.c2
-rw-r--r--fs/nfs/nfs4state.c18
4 files changed, 14 insertions, 14 deletions
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index 095bf4690e84..2b141c5758ec 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -182,6 +182,7 @@ struct nfs4_state_recovery_ops {
182 182
183struct nfs4_state_maintenance_ops { 183struct nfs4_state_maintenance_ops {
184 int (*sched_state_renewal)(struct nfs_client *, struct rpc_cred *); 184 int (*sched_state_renewal)(struct nfs_client *, struct rpc_cred *);
185 struct rpc_cred * (*get_state_renewal_cred_locked)(struct nfs_client *);
185 int (*renew_lease)(struct nfs_client *, struct rpc_cred *); 186 int (*renew_lease)(struct nfs_client *, struct rpc_cred *);
186}; 187};
187 188
@@ -240,7 +241,11 @@ extern void nfs4_kill_renewd(struct nfs_client *);
240extern void nfs4_renew_state(struct work_struct *); 241extern void nfs4_renew_state(struct work_struct *);
241 242
242/* nfs4state.c */ 243/* nfs4state.c */
244struct rpc_cred *nfs4_get_setclientid_cred(struct nfs_client *clp);
243struct rpc_cred *nfs4_get_renew_cred_locked(struct nfs_client *clp); 245struct rpc_cred *nfs4_get_renew_cred_locked(struct nfs_client *clp);
246#if defined(CONFIG_NFS_V4_1)
247struct rpc_cred *nfs4_get_machine_cred_locked(struct nfs_client *clp);
248#endif /* CONFIG_NFS_V4_1 */
244 249
245extern struct nfs4_state_owner * nfs4_get_state_owner(struct nfs_server *, struct rpc_cred *); 250extern struct nfs4_state_owner * nfs4_get_state_owner(struct nfs_server *, struct rpc_cred *);
246extern void nfs4_put_state_owner(struct nfs4_state_owner *); 251extern void nfs4_put_state_owner(struct nfs4_state_owner *);
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index da481bda44f7..f862a66e5fb9 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -4236,6 +4236,7 @@ static int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred)
4236 4236
4237 dprintk("--> %s\n", __func__); 4237 dprintk("--> %s\n", __func__);
4238 BUG_ON(clp == NULL); 4238 BUG_ON(clp == NULL);
4239
4239 p = (u32 *)verifier.data; 4240 p = (u32 *)verifier.data;
4240 *p++ = htonl((u32)clp->cl_boot_time.tv_sec); 4241 *p++ = htonl((u32)clp->cl_boot_time.tv_sec);
4241 *p = htonl((u32)clp->cl_boot_time.tv_nsec); 4242 *p = htonl((u32)clp->cl_boot_time.tv_nsec);
@@ -4795,12 +4796,14 @@ struct nfs4_state_recovery_ops nfs4_nograce_recovery_ops = {
4795 4796
4796struct nfs4_state_maintenance_ops nfs40_state_renewal_ops = { 4797struct nfs4_state_maintenance_ops nfs40_state_renewal_ops = {
4797 .sched_state_renewal = nfs4_proc_async_renew, 4798 .sched_state_renewal = nfs4_proc_async_renew,
4799 .get_state_renewal_cred_locked = nfs4_get_renew_cred_locked,
4798 .renew_lease = nfs4_proc_renew, 4800 .renew_lease = nfs4_proc_renew,
4799}; 4801};
4800 4802
4801#if defined(CONFIG_NFS_V4_1) 4803#if defined(CONFIG_NFS_V4_1)
4802struct nfs4_state_maintenance_ops nfs41_state_renewal_ops = { 4804struct nfs4_state_maintenance_ops nfs41_state_renewal_ops = {
4803 .sched_state_renewal = nfs41_proc_async_sequence, 4805 .sched_state_renewal = nfs41_proc_async_sequence,
4806 .get_state_renewal_cred_locked = nfs4_get_machine_cred_locked,
4804 .renew_lease = nfs4_proc_sequence, 4807 .renew_lease = nfs4_proc_sequence,
4805}; 4808};
4806#endif 4809#endif
diff --git a/fs/nfs/nfs4renewd.c b/fs/nfs/nfs4renewd.c
index 92b43e87267c..e27c6cef18f2 100644
--- a/fs/nfs/nfs4renewd.c
+++ b/fs/nfs/nfs4renewd.c
@@ -78,7 +78,7 @@ nfs4_renew_state(struct work_struct *work)
78 timeout = (2 * lease) / 3 + (long)last - (long)now; 78 timeout = (2 * lease) / 3 + (long)last - (long)now;
79 /* Are we close to a lease timeout? */ 79 /* Are we close to a lease timeout? */
80 if (time_after(now, last + lease/3)) { 80 if (time_after(now, last + lease/3)) {
81 cred = nfs4_get_renew_cred_locked(clp); 81 cred = ops->get_state_renewal_cred_locked(clp);
82 spin_unlock(&clp->cl_lock); 82 spin_unlock(&clp->cl_lock);
83 if (cred == NULL) { 83 if (cred == NULL) {
84 if (list_empty(&clp->cl_delegations)) { 84 if (list_empty(&clp->cl_delegations)) {
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index dc5599c7f4d9..da940abcfaa5 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -77,7 +77,7 @@ static int nfs4_init_client(struct nfs_client *clp, struct rpc_cred *cred)
77 return status; 77 return status;
78} 78}
79 79
80static struct rpc_cred *nfs4_get_machine_cred_locked(struct nfs_client *clp) 80struct rpc_cred *nfs4_get_machine_cred_locked(struct nfs_client *clp)
81{ 81{
82 struct rpc_cred *cred = NULL; 82 struct rpc_cred *cred = NULL;
83 83
@@ -114,17 +114,7 @@ struct rpc_cred *nfs4_get_renew_cred_locked(struct nfs_client *clp)
114 return cred; 114 return cred;
115} 115}
116 116
117static struct rpc_cred *nfs4_get_renew_cred(struct nfs_client *clp) 117struct rpc_cred *nfs4_get_setclientid_cred(struct nfs_client *clp)
118{
119 struct rpc_cred *cred;
120
121 spin_lock(&clp->cl_lock);
122 cred = nfs4_get_renew_cred_locked(clp);
123 spin_unlock(&clp->cl_lock);
124 return cred;
125}
126
127static struct rpc_cred *nfs4_get_setclientid_cred(struct nfs_client *clp)
128{ 118{
129 struct nfs4_state_owner *sp; 119 struct nfs4_state_owner *sp;
130 struct rb_node *pos; 120 struct rb_node *pos;
@@ -1090,7 +1080,9 @@ static int nfs4_check_lease(struct nfs_client *clp)
1090 /* Is the client already known to have an expired lease? */ 1080 /* Is the client already known to have an expired lease? */
1091 if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) 1081 if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state))
1092 return 0; 1082 return 0;
1093 cred = nfs4_get_renew_cred(clp); 1083 spin_lock(&clp->cl_lock);
1084 cred = ops->get_state_renewal_cred_locked(clp);
1085 spin_unlock(&clp->cl_lock);
1094 if (cred == NULL) { 1086 if (cred == NULL) {
1095 cred = nfs4_get_setclientid_cred(clp); 1087 cred = nfs4_get_setclientid_cred(clp);
1096 if (cred == NULL) 1088 if (cred == NULL)