aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/delegation.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2006-01-03 03:55:24 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-01-06 14:58:46 -0500
commit58d9714a44a79bba9b414da3ffbf3c753dc5915f (patch)
tree623141f0a40a470c0c81c2edcd8c45c6b0daf4f9 /fs/nfs/delegation.c
parent5043e900f5404c01864fbeb5826aa7de3981bbc1 (diff)
NFSv4: Send RENEW requests to the server only when we're holding state
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/delegation.c')
-rw-r--r--fs/nfs/delegation.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index 618a327027b3..75dfb1c717a0 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -8,6 +8,7 @@
8 */ 8 */
9#include <linux/config.h> 9#include <linux/config.h>
10#include <linux/completion.h> 10#include <linux/completion.h>
11#include <linux/kthread.h>
11#include <linux/module.h> 12#include <linux/module.h>
12#include <linux/sched.h> 13#include <linux/sched.h>
13#include <linux/spinlock.h> 14#include <linux/spinlock.h>
@@ -231,6 +232,51 @@ restart:
231 spin_unlock(&clp->cl_lock); 232 spin_unlock(&clp->cl_lock);
232} 233}
233 234
235int nfs_do_expire_all_delegations(void *ptr)
236{
237 struct nfs4_client *clp = ptr;
238 struct nfs_delegation *delegation;
239 struct inode *inode;
240 int err = 0;
241
242 allow_signal(SIGKILL);
243restart:
244 spin_lock(&clp->cl_lock);
245 if (test_bit(NFS4CLNT_STATE_RECOVER, &clp->cl_state) != 0)
246 goto out;
247 if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) == 0)
248 goto out;
249 list_for_each_entry(delegation, &clp->cl_delegations, super_list) {
250 inode = igrab(delegation->inode);
251 if (inode == NULL)
252 continue;
253 spin_unlock(&clp->cl_lock);
254 err = nfs_inode_return_delegation(inode);
255 iput(inode);
256 if (!err)
257 goto restart;
258 }
259out:
260 spin_unlock(&clp->cl_lock);
261 nfs4_put_client(clp);
262 module_put_and_exit(0);
263}
264
265void nfs_expire_all_delegations(struct nfs4_client *clp)
266{
267 struct task_struct *task;
268
269 __module_get(THIS_MODULE);
270 atomic_inc(&clp->cl_count);
271 task = kthread_run(nfs_do_expire_all_delegations, clp,
272 "%u.%u.%u.%u-delegreturn",
273 NIPQUAD(clp->cl_addr));
274 if (!IS_ERR(task))
275 return;
276 nfs4_put_client(clp);
277 module_put(THIS_MODULE);
278}
279
234/* 280/*
235 * Return all delegations following an NFS4ERR_CB_PATH_DOWN error. 281 * Return all delegations following an NFS4ERR_CB_PATH_DOWN error.
236 */ 282 */