aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2010-06-16 09:52:27 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-06-22 13:24:02 -0400
commite047a10c1293ee0ab20258154e7f3ebf8ad502d6 (patch)
tree7dacba9544d57462b136893903398ce08b3a8435 /fs
parentc48f4f3541e67881c9eb7c46e052f5ece48ef530 (diff)
NFSv41: Fix nfs_async_inode_return_delegation() ugliness
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/callback_proc.c13
-rw-r--r--fs/nfs/delegation.c6
-rw-r--r--fs/nfs/delegation.h4
-rw-r--r--fs/nfs/nfs4_fs.h2
-rw-r--r--fs/nfs/nfs4proc.c2
5 files changed, 8 insertions, 19 deletions
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
index a08770a7e857..7445dd0ae3f3 100644
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -62,16 +62,6 @@ out:
62 return res->status; 62 return res->status;
63} 63}
64 64
65static int (*nfs_validate_delegation_stateid(struct nfs_client *clp))(struct nfs_delegation *, const nfs4_stateid *)
66{
67#if defined(CONFIG_NFS_V4_1)
68 if (clp->cl_minorversion > 0)
69 return nfs41_validate_delegation_stateid;
70#endif
71 return nfs4_validate_delegation_stateid;
72}
73
74
75__be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy) 65__be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy)
76{ 66{
77 struct nfs_client *clp; 67 struct nfs_client *clp;
@@ -92,8 +82,7 @@ __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy)
92 inode = nfs_delegation_find_inode(clp, &args->fh); 82 inode = nfs_delegation_find_inode(clp, &args->fh);
93 if (inode != NULL) { 83 if (inode != NULL) {
94 /* Set up a helper thread to actually return the delegation */ 84 /* Set up a helper thread to actually return the delegation */
95 switch (nfs_async_inode_return_delegation(inode, &args->stateid, 85 switch (nfs_async_inode_return_delegation(inode, &args->stateid)) {
96 nfs_validate_delegation_stateid(clp))) {
97 case 0: 86 case 0:
98 res = 0; 87 res = 0;
99 break; 88 break;
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index 301634543974..f34f4ac52b81 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -471,9 +471,7 @@ void nfs_expire_unreferenced_delegations(struct nfs_client *clp)
471/* 471/*
472 * Asynchronous delegation recall! 472 * Asynchronous delegation recall!
473 */ 473 */
474int nfs_async_inode_return_delegation(struct inode *inode, const nfs4_stateid *stateid, 474int nfs_async_inode_return_delegation(struct inode *inode, const nfs4_stateid *stateid)
475 int (*validate_stateid)(struct nfs_delegation *delegation,
476 const nfs4_stateid *stateid))
477{ 475{
478 struct nfs_client *clp = NFS_SERVER(inode)->nfs_client; 476 struct nfs_client *clp = NFS_SERVER(inode)->nfs_client;
479 struct nfs_delegation *delegation; 477 struct nfs_delegation *delegation;
@@ -481,7 +479,7 @@ int nfs_async_inode_return_delegation(struct inode *inode, const nfs4_stateid *s
481 rcu_read_lock(); 479 rcu_read_lock();
482 delegation = rcu_dereference(NFS_I(inode)->delegation); 480 delegation = rcu_dereference(NFS_I(inode)->delegation);
483 481
484 if (!validate_stateid(delegation, stateid)) { 482 if (!clp->cl_mvops->validate_stateid(delegation, stateid)) {
485 rcu_read_unlock(); 483 rcu_read_unlock();
486 return -ENOENT; 484 return -ENOENT;
487 } 485 }
diff --git a/fs/nfs/delegation.h b/fs/nfs/delegation.h
index 69e7b8140122..2026304bda19 100644
--- a/fs/nfs/delegation.h
+++ b/fs/nfs/delegation.h
@@ -34,9 +34,7 @@ enum {
34int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct nfs_openres *res); 34int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct nfs_openres *res);
35void nfs_inode_reclaim_delegation(struct inode *inode, struct rpc_cred *cred, struct nfs_openres *res); 35void nfs_inode_reclaim_delegation(struct inode *inode, struct rpc_cred *cred, struct nfs_openres *res);
36int nfs_inode_return_delegation(struct inode *inode); 36int nfs_inode_return_delegation(struct inode *inode);
37int nfs_async_inode_return_delegation(struct inode *inode, const nfs4_stateid *stateid, 37int nfs_async_inode_return_delegation(struct inode *inode, const nfs4_stateid *stateid);
38 int (*validate_stateid)(struct nfs_delegation *delegation,
39 const nfs4_stateid *stateid));
40void nfs_inode_return_delegation_noreclaim(struct inode *inode); 38void nfs_inode_return_delegation_noreclaim(struct inode *inode);
41 39
42struct inode *nfs_delegation_find_inode(struct nfs_client *clp, const struct nfs_fh *fhandle); 40struct inode *nfs_delegation_find_inode(struct nfs_client *clp, const struct nfs_fh *fhandle);
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index 1ff0ea2a8461..04eff16b34d3 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -60,6 +60,8 @@ 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 int (*validate_stateid)(struct nfs_delegation *,
64 const nfs4_stateid *);
63 const struct nfs4_state_recovery_ops *reboot_recovery_ops; 65 const struct nfs4_state_recovery_ops *reboot_recovery_ops;
64 const struct nfs4_state_recovery_ops *nograce_recovery_ops; 66 const struct nfs4_state_recovery_ops *nograce_recovery_ops;
65 const struct nfs4_state_maintenance_ops *state_renewal_ops; 67 const struct nfs4_state_maintenance_ops *state_renewal_ops;
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 9f222f57e75b..d1ab0c36e939 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -5356,6 +5356,7 @@ 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 .validate_stateid = nfs4_validate_delegation_stateid,
5359 .reboot_recovery_ops = &nfs40_reboot_recovery_ops, 5360 .reboot_recovery_ops = &nfs40_reboot_recovery_ops,
5360 .nograce_recovery_ops = &nfs40_nograce_recovery_ops, 5361 .nograce_recovery_ops = &nfs40_nograce_recovery_ops,
5361 .state_renewal_ops = &nfs40_state_renewal_ops, 5362 .state_renewal_ops = &nfs40_state_renewal_ops,
@@ -5365,6 +5366,7 @@ static const struct nfs4_minor_version_ops nfs_v4_0_minor_ops = {
5365static const struct nfs4_minor_version_ops nfs_v4_1_minor_ops = { 5366static const struct nfs4_minor_version_ops nfs_v4_1_minor_ops = {
5366 .minor_version = 1, 5367 .minor_version = 1,
5367 .call_sync = _nfs4_call_sync_session, 5368 .call_sync = _nfs4_call_sync_session,
5369 .validate_stateid = nfs41_validate_delegation_stateid,
5368 .reboot_recovery_ops = &nfs41_reboot_recovery_ops, 5370 .reboot_recovery_ops = &nfs41_reboot_recovery_ops,
5369 .nograce_recovery_ops = &nfs41_nograce_recovery_ops, 5371 .nograce_recovery_ops = &nfs41_nograce_recovery_ops,
5370 .state_renewal_ops = &nfs41_state_renewal_ops, 5372 .state_renewal_ops = &nfs41_state_renewal_ops,