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>
This commit is contained in:
@@ -354,37 +354,16 @@ static void nfs_client_mark_return_all_delegations(struct nfs_client *clp)
|
|||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nfs_do_expire_all_delegations(void *ptr)
|
static void nfs_delegation_run_state_manager(struct nfs_client *clp)
|
||||||
{
|
{
|
||||||
struct nfs_client *clp = ptr;
|
if (test_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state))
|
||||||
|
nfs4_schedule_state_manager(clp);
|
||||||
allow_signal(SIGKILL);
|
|
||||||
|
|
||||||
if (test_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state) != 0)
|
|
||||||
goto out;
|
|
||||||
if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) == 0)
|
|
||||||
goto out;
|
|
||||||
nfs_client_mark_return_all_delegations(clp);
|
|
||||||
nfs_client_return_marked_delegations(clp);
|
|
||||||
out:
|
|
||||||
nfs_put_client(clp);
|
|
||||||
module_put_and_exit(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void nfs_expire_all_delegations(struct nfs_client *clp)
|
void nfs_expire_all_delegations(struct nfs_client *clp)
|
||||||
{
|
{
|
||||||
struct task_struct *task;
|
nfs_client_mark_return_all_delegations(clp);
|
||||||
|
nfs_delegation_run_state_manager(clp);
|
||||||
__module_get(THIS_MODULE);
|
|
||||||
atomic_inc(&clp->cl_count);
|
|
||||||
task = kthread_run(nfs_do_expire_all_delegations, clp,
|
|
||||||
"%s-delegreturn",
|
|
||||||
rpc_peeraddr2str(clp->cl_rpcclient,
|
|
||||||
RPC_DISPLAY_ADDR));
|
|
||||||
if (!IS_ERR(task))
|
|
||||||
return;
|
|
||||||
nfs_put_client(clp);
|
|
||||||
module_put(THIS_MODULE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -227,6 +227,7 @@ extern void nfs4_close_state(struct path *, struct nfs4_state *, mode_t);
|
|||||||
extern void nfs4_close_sync(struct path *, struct nfs4_state *, mode_t);
|
extern void nfs4_close_sync(struct path *, struct nfs4_state *, mode_t);
|
||||||
extern void nfs4_state_set_mode_locked(struct nfs4_state *, mode_t);
|
extern void nfs4_state_set_mode_locked(struct nfs4_state *, mode_t);
|
||||||
extern void nfs4_schedule_state_recovery(struct nfs_client *);
|
extern void nfs4_schedule_state_recovery(struct nfs_client *);
|
||||||
|
extern void nfs4_schedule_state_manager(struct nfs_client *);
|
||||||
extern int nfs4_state_mark_reclaim_nograce(struct nfs_client *clp, struct nfs4_state *state);
|
extern int nfs4_state_mark_reclaim_nograce(struct nfs_client *clp, struct nfs4_state *state);
|
||||||
extern void nfs4_put_lock_state(struct nfs4_lock_state *lsp);
|
extern void nfs4_put_lock_state(struct nfs4_lock_state *lsp);
|
||||||
extern int nfs4_set_lock_state(struct nfs4_state *state, struct file_lock *fl);
|
extern int nfs4_set_lock_state(struct nfs4_state *state, struct file_lock *fl);
|
||||||
|
@@ -77,16 +77,18 @@ nfs4_renew_state(struct work_struct *work)
|
|||||||
/* Are we close to a lease timeout? */
|
/* Are we close to a lease timeout? */
|
||||||
if (time_after(now, last + lease/3)) {
|
if (time_after(now, last + lease/3)) {
|
||||||
cred = nfs4_get_renew_cred_locked(clp);
|
cred = nfs4_get_renew_cred_locked(clp);
|
||||||
if (cred == NULL) {
|
|
||||||
set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
|
|
||||||
spin_unlock(&clp->cl_lock);
|
spin_unlock(&clp->cl_lock);
|
||||||
nfs_expire_all_delegations(clp);
|
if (cred == NULL) {
|
||||||
|
if (list_empty(&clp->cl_delegations)) {
|
||||||
|
set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
spin_unlock(&clp->cl_lock);
|
nfs_expire_all_delegations(clp);
|
||||||
|
} else {
|
||||||
/* Queue an asynchronous RENEW. */
|
/* Queue an asynchronous RENEW. */
|
||||||
nfs4_proc_async_renew(clp, cred);
|
nfs4_proc_async_renew(clp, cred);
|
||||||
put_rpccred(cred);
|
put_rpccred(cred);
|
||||||
|
}
|
||||||
timeout = (2 * lease) / 3;
|
timeout = (2 * lease) / 3;
|
||||||
spin_lock(&clp->cl_lock);
|
spin_lock(&clp->cl_lock);
|
||||||
} else
|
} else
|
||||||
|
@@ -781,7 +781,7 @@ static void nfs4_clear_state_manager_bit(struct nfs_client *clp)
|
|||||||
/*
|
/*
|
||||||
* Schedule the nfs_client asynchronous state management routine
|
* Schedule the nfs_client asynchronous state management routine
|
||||||
*/
|
*/
|
||||||
static void nfs4_schedule_state_manager(struct nfs_client *clp)
|
void nfs4_schedule_state_manager(struct nfs_client *clp)
|
||||||
{
|
{
|
||||||
struct task_struct *task;
|
struct task_struct *task;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user