aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfs/nfs4_fs.h6
-rw-r--r--fs/nfs/nfs4proc.c31
-rw-r--r--fs/nfs/nfs4renewd.c4
-rw-r--r--fs/nfs/nfs4state.c15
4 files changed, 18 insertions, 38 deletions
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index 5b01705e30f9..1ff0ea2a8461 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -60,6 +60,9 @@ struct nfs4_minor_version_ops {
60 struct nfs4_sequence_args *args, 60 struct nfs4_sequence_args *args,
61 struct nfs4_sequence_res *res, 61 struct nfs4_sequence_res *res,
62 int cache_reply); 62 int cache_reply);
63 const struct nfs4_state_recovery_ops *reboot_recovery_ops;
64 const struct nfs4_state_recovery_ops *nograce_recovery_ops;
65 const struct nfs4_state_maintenance_ops *state_renewal_ops;
63}; 66};
64 67
65/* 68/*
@@ -233,8 +236,6 @@ extern int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fh
233extern int nfs4_proc_fs_locations(struct inode *dir, const struct qstr *name, 236extern int nfs4_proc_fs_locations(struct inode *dir, const struct qstr *name,
234 struct nfs4_fs_locations *fs_locations, struct page *page); 237 struct nfs4_fs_locations *fs_locations, struct page *page);
235 238
236extern struct nfs4_state_recovery_ops *nfs4_reboot_recovery_ops[];
237extern struct nfs4_state_recovery_ops *nfs4_nograce_recovery_ops[];
238#if defined(CONFIG_NFS_V4_1) 239#if defined(CONFIG_NFS_V4_1)
239static inline struct nfs4_session *nfs4_get_session(const struct nfs_server *server) 240static inline struct nfs4_session *nfs4_get_session(const struct nfs_server *server)
240{ 241{
@@ -271,7 +272,6 @@ static inline int nfs4_init_session(struct nfs_server *server)
271#endif /* CONFIG_NFS_V4_1 */ 272#endif /* CONFIG_NFS_V4_1 */
272 273
273extern const struct nfs4_minor_version_ops *nfs_v4_minor_ops[]; 274extern const struct nfs4_minor_version_ops *nfs_v4_minor_ops[];
274extern struct nfs4_state_maintenance_ops *nfs4_state_renewal_ops[];
275 275
276extern const u32 nfs4_fattr_bitmap[2]; 276extern const u32 nfs4_fattr_bitmap[2];
277extern const u32 nfs4_statfs_bitmap[2]; 277extern const u32 nfs4_statfs_bitmap[2];
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index a938daf333da..9f222f57e75b 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -5356,40 +5356,21 @@ struct nfs4_state_maintenance_ops nfs41_state_renewal_ops = {
5356static const struct nfs4_minor_version_ops nfs_v4_0_minor_ops = { 5356static const struct nfs4_minor_version_ops nfs_v4_0_minor_ops = {
5357 .minor_version = 0, 5357 .minor_version = 0,
5358 .call_sync = _nfs4_call_sync, 5358 .call_sync = _nfs4_call_sync,
5359 .reboot_recovery_ops = &nfs40_reboot_recovery_ops,
5360 .nograce_recovery_ops = &nfs40_nograce_recovery_ops,
5361 .state_renewal_ops = &nfs40_state_renewal_ops,
5359}; 5362};
5360 5363
5361#if defined(CONFIG_NFS_V4_1) 5364#if defined(CONFIG_NFS_V4_1)
5362static const struct nfs4_minor_version_ops nfs_v4_1_minor_ops = { 5365static const struct nfs4_minor_version_ops nfs_v4_1_minor_ops = {
5363 .minor_version = 1, 5366 .minor_version = 1,
5364 .call_sync = _nfs4_call_sync_session, 5367 .call_sync = _nfs4_call_sync_session,
5368 .reboot_recovery_ops = &nfs41_reboot_recovery_ops,
5369 .nograce_recovery_ops = &nfs41_nograce_recovery_ops,
5370 .state_renewal_ops = &nfs41_state_renewal_ops,
5365}; 5371};
5366#endif 5372#endif
5367 5373
5368/*
5369 * Per minor version reboot and network partition recovery ops
5370 */
5371
5372struct nfs4_state_recovery_ops *nfs4_reboot_recovery_ops[] = {
5373 &nfs40_reboot_recovery_ops,
5374#if defined(CONFIG_NFS_V4_1)
5375 &nfs41_reboot_recovery_ops,
5376#endif
5377};
5378
5379struct nfs4_state_recovery_ops *nfs4_nograce_recovery_ops[] = {
5380 &nfs40_nograce_recovery_ops,
5381#if defined(CONFIG_NFS_V4_1)
5382 &nfs41_nograce_recovery_ops,
5383#endif
5384};
5385
5386struct nfs4_state_maintenance_ops *nfs4_state_renewal_ops[] = {
5387 &nfs40_state_renewal_ops,
5388#if defined(CONFIG_NFS_V4_1)
5389 &nfs41_state_renewal_ops,
5390#endif
5391};
5392
5393const struct nfs4_minor_version_ops *nfs_v4_minor_ops[] = { 5374const struct nfs4_minor_version_ops *nfs_v4_minor_ops[] = {
5394 [0] = &nfs_v4_0_minor_ops, 5375 [0] = &nfs_v4_0_minor_ops,
5395#if defined(CONFIG_NFS_V4_1) 5376#if defined(CONFIG_NFS_V4_1)
diff --git a/fs/nfs/nfs4renewd.c b/fs/nfs/nfs4renewd.c
index d87f10327b72..72b6c580af13 100644
--- a/fs/nfs/nfs4renewd.c
+++ b/fs/nfs/nfs4renewd.c
@@ -54,14 +54,14 @@
54void 54void
55nfs4_renew_state(struct work_struct *work) 55nfs4_renew_state(struct work_struct *work)
56{ 56{
57 struct nfs4_state_maintenance_ops *ops; 57 const struct nfs4_state_maintenance_ops *ops;
58 struct nfs_client *clp = 58 struct nfs_client *clp =
59 container_of(work, struct nfs_client, cl_renewd.work); 59 container_of(work, struct nfs_client, cl_renewd.work);
60 struct rpc_cred *cred; 60 struct rpc_cred *cred;
61 long lease; 61 long lease;
62 unsigned long last, now; 62 unsigned long last, now;
63 63
64 ops = nfs4_state_renewal_ops[clp->cl_minorversion]; 64 ops = clp->cl_mvops->state_renewal_ops;
65 dprintk("%s: start\n", __func__); 65 dprintk("%s: start\n", __func__);
66 /* Are there any active superblocks? */ 66 /* Are there any active superblocks? */
67 if (list_empty(&clp->cl_superblocks)) 67 if (list_empty(&clp->cl_superblocks))
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 4538c56a7f05..c3c6b8aeb209 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -1122,8 +1122,7 @@ static void nfs4_state_end_reclaim_reboot(struct nfs_client *clp)
1122 if (!test_and_clear_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) 1122 if (!test_and_clear_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state))
1123 return; 1123 return;
1124 1124
1125 nfs4_reclaim_complete(clp, 1125 nfs4_reclaim_complete(clp, clp->cl_mvops->reboot_recovery_ops);
1126 nfs4_reboot_recovery_ops[clp->cl_minorversion]);
1127 1126
1128 for (pos = rb_first(&clp->cl_state_owners); pos != NULL; pos = rb_next(pos)) { 1127 for (pos = rb_first(&clp->cl_state_owners); pos != NULL; pos = rb_next(pos)) {
1129 sp = rb_entry(pos, struct nfs4_state_owner, so_client_node); 1128 sp = rb_entry(pos, struct nfs4_state_owner, so_client_node);
@@ -1213,8 +1212,8 @@ restart:
1213static int nfs4_check_lease(struct nfs_client *clp) 1212static int nfs4_check_lease(struct nfs_client *clp)
1214{ 1213{
1215 struct rpc_cred *cred; 1214 struct rpc_cred *cred;
1216 struct nfs4_state_maintenance_ops *ops = 1215 const struct nfs4_state_maintenance_ops *ops =
1217 nfs4_state_renewal_ops[clp->cl_minorversion]; 1216 clp->cl_mvops->state_renewal_ops;
1218 int status = -NFS4ERR_EXPIRED; 1217 int status = -NFS4ERR_EXPIRED;
1219 1218
1220 /* Is the client already known to have an expired lease? */ 1219 /* Is the client already known to have an expired lease? */
@@ -1237,8 +1236,8 @@ out:
1237static int nfs4_reclaim_lease(struct nfs_client *clp) 1236static int nfs4_reclaim_lease(struct nfs_client *clp)
1238{ 1237{
1239 struct rpc_cred *cred; 1238 struct rpc_cred *cred;
1240 struct nfs4_state_recovery_ops *ops = 1239 const struct nfs4_state_recovery_ops *ops =
1241 nfs4_reboot_recovery_ops[clp->cl_minorversion]; 1240 clp->cl_mvops->reboot_recovery_ops;
1242 int status = -ENOENT; 1241 int status = -ENOENT;
1243 1242
1244 cred = ops->get_clid_cred(clp); 1243 cred = ops->get_clid_cred(clp);
@@ -1446,7 +1445,7 @@ static void nfs4_state_manager(struct nfs_client *clp)
1446 /* First recover reboot state... */ 1445 /* First recover reboot state... */
1447 if (test_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) { 1446 if (test_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) {
1448 status = nfs4_do_reclaim(clp, 1447 status = nfs4_do_reclaim(clp,
1449 nfs4_reboot_recovery_ops[clp->cl_minorversion]); 1448 clp->cl_mvops->reboot_recovery_ops);
1450 if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) || 1449 if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) ||
1451 test_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state)) 1450 test_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state))
1452 continue; 1451 continue;
@@ -1460,7 +1459,7 @@ static void nfs4_state_manager(struct nfs_client *clp)
1460 /* Now recover expired state... */ 1459 /* Now recover expired state... */
1461 if (test_and_clear_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state)) { 1460 if (test_and_clear_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state)) {
1462 status = nfs4_do_reclaim(clp, 1461 status = nfs4_do_reclaim(clp,
1463 nfs4_nograce_recovery_ops[clp->cl_minorversion]); 1462 clp->cl_mvops->nograce_recovery_ops);
1464 if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) || 1463 if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) ||
1465 test_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state) || 1464 test_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state) ||
1466 test_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) 1465 test_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state))