aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2008-12-23 15:21:50 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-12-23 15:21:50 -0500
commitb0d3ded1a21dc3057daff5a488469d9e6aa1b567 (patch)
tree1e30c75402d091e19219d73850879317bb345b87 /fs
parent0d62f85a81216f30a0ba1479b93e84103a5d535b (diff)
NFSv4: Clean up nfs_expire_all_delegations()
Let the actual delegreturn stuff be run in the state manager thread rather than allocating a separate kthread. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/delegation.c31
-rw-r--r--fs/nfs/nfs4_fs.h1
-rw-r--r--fs/nfs/nfs4renewd.c16
-rw-r--r--fs/nfs/nfs4state.c2
4 files changed, 16 insertions, 34 deletions
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index 4692fdc8abf3..21eda6c083d0 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -354,37 +354,16 @@ static void nfs_client_mark_return_all_delegations(struct nfs_client *clp)
354 rcu_read_unlock(); 354 rcu_read_unlock();
355} 355}
356 356
357static int nfs_do_expire_all_delegations(void *ptr) 357static void nfs_delegation_run_state_manager(struct nfs_client *clp)
358{ 358{
359 struct nfs_client *clp = ptr; 359 if (test_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state))
360 360 nfs4_schedule_state_manager(clp);
361 allow_signal(SIGKILL);
362
363 if (test_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state) != 0)
364 goto out;
365 if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) == 0)
366 goto out;
367 nfs_client_mark_return_all_delegations(clp);
368 nfs_client_return_marked_delegations(clp);
369out:
370 nfs_put_client(clp);
371 module_put_and_exit(0);
372} 361}
373 362
374void nfs_expire_all_delegations(struct nfs_client *clp) 363void nfs_expire_all_delegations(struct nfs_client *clp)
375{ 364{
376 struct task_struct *task; 365 nfs_client_mark_return_all_delegations(clp);
377 366 nfs_delegation_run_state_manager(clp);
378 __module_get(THIS_MODULE);
379 atomic_inc(&clp->cl_count);
380 task = kthread_run(nfs_do_expire_all_delegations, clp,
381 "%s-delegreturn",
382 rpc_peeraddr2str(clp->cl_rpcclient,
383 RPC_DISPLAY_ADDR));
384 if (!IS_ERR(task))
385 return;
386 nfs_put_client(clp);
387 module_put(THIS_MODULE);
388} 367}
389 368
390/* 369/*
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index b7a12e7c6604..ee5f51ef696d 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -227,6 +227,7 @@ extern void nfs4_close_state(struct path *, struct nfs4_state *, mode_t);
227extern void nfs4_close_sync(struct path *, struct nfs4_state *, mode_t); 227extern void nfs4_close_sync(struct path *, struct nfs4_state *, mode_t);
228extern void nfs4_state_set_mode_locked(struct nfs4_state *, mode_t); 228extern void nfs4_state_set_mode_locked(struct nfs4_state *, mode_t);
229extern void nfs4_schedule_state_recovery(struct nfs_client *); 229extern void nfs4_schedule_state_recovery(struct nfs_client *);
230extern void nfs4_schedule_state_manager(struct nfs_client *);
230extern int nfs4_state_mark_reclaim_nograce(struct nfs_client *clp, struct nfs4_state *state); 231extern int nfs4_state_mark_reclaim_nograce(struct nfs_client *clp, struct nfs4_state *state);
231extern void nfs4_put_lock_state(struct nfs4_lock_state *lsp); 232extern void nfs4_put_lock_state(struct nfs4_lock_state *lsp);
232extern int nfs4_set_lock_state(struct nfs4_state *state, struct file_lock *fl); 233extern int nfs4_set_lock_state(struct nfs4_state *state, struct file_lock *fl);
diff --git a/fs/nfs/nfs4renewd.c b/fs/nfs/nfs4renewd.c
index 6101f955f231..ca557e677d9e 100644
--- a/fs/nfs/nfs4renewd.c
+++ b/fs/nfs/nfs4renewd.c
@@ -77,16 +77,18 @@ nfs4_renew_state(struct work_struct *work)
77 /* Are we close to a lease timeout? */ 77 /* Are we close to a lease timeout? */
78 if (time_after(now, last + lease/3)) { 78 if (time_after(now, last + lease/3)) {
79 cred = nfs4_get_renew_cred_locked(clp); 79 cred = nfs4_get_renew_cred_locked(clp);
80 spin_unlock(&clp->cl_lock);
80 if (cred == NULL) { 81 if (cred == NULL) {
81 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); 82 if (list_empty(&clp->cl_delegations)) {
82 spin_unlock(&clp->cl_lock); 83 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
84 goto out;
85 }
83 nfs_expire_all_delegations(clp); 86 nfs_expire_all_delegations(clp);
84 goto out; 87 } else {
88 /* Queue an asynchronous RENEW. */
89 nfs4_proc_async_renew(clp, cred);
90 put_rpccred(cred);
85 } 91 }
86 spin_unlock(&clp->cl_lock);
87 /* Queue an asynchronous RENEW. */
88 nfs4_proc_async_renew(clp, cred);
89 put_rpccred(cred);
90 timeout = (2 * lease) / 3; 92 timeout = (2 * lease) / 3;
91 spin_lock(&clp->cl_lock); 93 spin_lock(&clp->cl_lock);
92 } else 94 } else
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 6dc36a0d9a85..cd16b301f13c 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -781,7 +781,7 @@ static void nfs4_clear_state_manager_bit(struct nfs_client *clp)
781/* 781/*
782 * Schedule the nfs_client asynchronous state management routine 782 * Schedule the nfs_client asynchronous state management routine
783 */ 783 */
784static void nfs4_schedule_state_manager(struct nfs_client *clp) 784void nfs4_schedule_state_manager(struct nfs_client *clp)
785{ 785{
786 struct task_struct *task; 786 struct task_struct *task;
787 787