diff options
author | Benny Halevy <bhalevy@panasas.com> | 2009-04-01 09:22:44 -0400 |
---|---|---|
committer | Benny Halevy <bhalevy@panasas.com> | 2009-06-17 15:25:09 -0400 |
commit | 29fba38b793225798104a1ac870e6807ebd078dd (patch) | |
tree | 35b5fb1999a29b1b43ad1c4d1c816f42942bca99 /fs | |
parent | b069d94af7785750228287c35f9ce5c463515726 (diff) |
nfs41: lease renewal
Send a NFSv4.1 SEQUENCE op rather than RENEW that was deprecated in
minorversion 1.
Use the nfs_client minorversion to select reboot_recover/
network_partition_recovery/state_renewal ops.
Note: we use reclaimer to create the nfs41 session before there are any
cl_superblocks for the nfs_client.
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[nfs41: check for session not minorversion]
Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[revamped patch for new nfs4_state_manager design]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[nfs41: obliterate nfs4_state_recovery_ops.renew_lease method]
moved to nfs4_state_maintenance_ops
[also undid per-minorversion nfs4_state_recovery_ops here]
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.h | 6 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 24 | ||||
-rw-r--r-- | fs/nfs/nfs4renewd.c | 4 |
3 files changed, 33 insertions, 1 deletions
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index 7cc1cddfd9ba..ae25cc21fe70 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
@@ -180,6 +180,10 @@ struct nfs4_state_recovery_ops { | |||
180 | int (*recover_lock)(struct nfs4_state *, struct file_lock *); | 180 | int (*recover_lock)(struct nfs4_state *, struct file_lock *); |
181 | }; | 181 | }; |
182 | 182 | ||
183 | struct nfs4_state_maintenance_ops { | ||
184 | int (*sched_state_renewal)(struct nfs_client *, struct rpc_cred *); | ||
185 | }; | ||
186 | |||
183 | extern const struct dentry_operations nfs4_dentry_operations; | 187 | extern const struct dentry_operations nfs4_dentry_operations; |
184 | extern const struct inode_operations nfs4_dir_inode_operations; | 188 | extern const struct inode_operations nfs4_dir_inode_operations; |
185 | 189 | ||
@@ -220,6 +224,8 @@ static inline int nfs4_setup_sequence(struct nfs_client *clp, | |||
220 | } | 224 | } |
221 | #endif /* CONFIG_NFS_V4_1 */ | 225 | #endif /* CONFIG_NFS_V4_1 */ |
222 | 226 | ||
227 | extern struct nfs4_state_maintenance_ops *nfs4_state_renewal_ops[]; | ||
228 | |||
223 | extern const u32 nfs4_fattr_bitmap[2]; | 229 | extern const u32 nfs4_fattr_bitmap[2]; |
224 | extern const u32 nfs4_statfs_bitmap[2]; | 230 | extern const u32 nfs4_statfs_bitmap[2]; |
225 | extern const u32 nfs4_pathconf_bitmap[2]; | 231 | extern const u32 nfs4_pathconf_bitmap[2]; |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index a2855391b079..101ba6aed101 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -3016,6 +3016,9 @@ static void nfs4_renew_done(struct rpc_task *task, void *data) | |||
3016 | if (time_before(clp->cl_last_renewal,timestamp)) | 3016 | if (time_before(clp->cl_last_renewal,timestamp)) |
3017 | clp->cl_last_renewal = timestamp; | 3017 | clp->cl_last_renewal = timestamp; |
3018 | spin_unlock(&clp->cl_lock); | 3018 | spin_unlock(&clp->cl_lock); |
3019 | dprintk("%s calling put_rpccred on rpc_cred %p\n", __func__, | ||
3020 | task->tk_msg.rpc_cred); | ||
3021 | put_rpccred(task->tk_msg.rpc_cred); | ||
3019 | } | 3022 | } |
3020 | 3023 | ||
3021 | static const struct rpc_call_ops nfs4_renew_ops = { | 3024 | static const struct rpc_call_ops nfs4_renew_ops = { |
@@ -4790,6 +4793,27 @@ struct nfs4_state_recovery_ops nfs4_nograce_recovery_ops = { | |||
4790 | .recover_lock = nfs4_lock_expired, | 4793 | .recover_lock = nfs4_lock_expired, |
4791 | }; | 4794 | }; |
4792 | 4795 | ||
4796 | struct nfs4_state_maintenance_ops nfs40_state_renewal_ops = { | ||
4797 | .sched_state_renewal = nfs4_proc_async_renew, | ||
4798 | }; | ||
4799 | |||
4800 | #if defined(CONFIG_NFS_V4_1) | ||
4801 | struct nfs4_state_maintenance_ops nfs41_state_renewal_ops = { | ||
4802 | .sched_state_renewal = nfs41_proc_async_sequence, | ||
4803 | }; | ||
4804 | #endif | ||
4805 | |||
4806 | /* | ||
4807 | * Per minor version reboot and network partition recovery ops | ||
4808 | */ | ||
4809 | |||
4810 | struct nfs4_state_maintenance_ops *nfs4_state_renewal_ops[] = { | ||
4811 | &nfs40_state_renewal_ops, | ||
4812 | #if defined(CONFIG_NFS_V4_1) | ||
4813 | &nfs41_state_renewal_ops, | ||
4814 | #endif | ||
4815 | }; | ||
4816 | |||
4793 | static const struct inode_operations nfs4_file_inode_operations = { | 4817 | static const struct inode_operations nfs4_file_inode_operations = { |
4794 | .permission = nfs_permission, | 4818 | .permission = nfs_permission, |
4795 | .getattr = nfs_getattr, | 4819 | .getattr = nfs_getattr, |
diff --git a/fs/nfs/nfs4renewd.c b/fs/nfs/nfs4renewd.c index f524e932ff7b..92b43e87267c 100644 --- a/fs/nfs/nfs4renewd.c +++ b/fs/nfs/nfs4renewd.c | |||
@@ -59,12 +59,14 @@ | |||
59 | void | 59 | void |
60 | nfs4_renew_state(struct work_struct *work) | 60 | nfs4_renew_state(struct work_struct *work) |
61 | { | 61 | { |
62 | struct nfs4_state_maintenance_ops *ops; | ||
62 | struct nfs_client *clp = | 63 | struct nfs_client *clp = |
63 | container_of(work, struct nfs_client, cl_renewd.work); | 64 | container_of(work, struct nfs_client, cl_renewd.work); |
64 | struct rpc_cred *cred; | 65 | struct rpc_cred *cred; |
65 | long lease, timeout; | 66 | long lease, timeout; |
66 | unsigned long last, now; | 67 | unsigned long last, now; |
67 | 68 | ||
69 | ops = nfs4_state_renewal_ops[clp->cl_minorversion]; | ||
68 | dprintk("%s: start\n", __func__); | 70 | dprintk("%s: start\n", __func__); |
69 | /* Are there any active superblocks? */ | 71 | /* Are there any active superblocks? */ |
70 | if (list_empty(&clp->cl_superblocks)) | 72 | if (list_empty(&clp->cl_superblocks)) |
@@ -86,7 +88,7 @@ nfs4_renew_state(struct work_struct *work) | |||
86 | nfs_expire_all_delegations(clp); | 88 | nfs_expire_all_delegations(clp); |
87 | } else { | 89 | } else { |
88 | /* Queue an asynchronous RENEW. */ | 90 | /* Queue an asynchronous RENEW. */ |
89 | nfs4_proc_async_renew(clp, cred); | 91 | ops->sched_state_renewal(clp, cred); |
90 | put_rpccred(cred); | 92 | put_rpccred(cred); |
91 | } | 93 | } |
92 | timeout = (2 * lease) / 3; | 94 | timeout = (2 * lease) / 3; |