Commit 707fb4b3 authored by Trond Myklebust's avatar Trond Myklebust

NFSv4: Clean up NFS4ERR_CB_PATH_DOWN error management...

Add a delegation cleanup phase to the state management loop, and do the
NFS4ERR_CB_PATH_DOWN recovery there.
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 515d8611
...@@ -258,7 +258,7 @@ static int __nfs_inode_return_delegation(struct inode *inode, struct nfs_delegat ...@@ -258,7 +258,7 @@ static int __nfs_inode_return_delegation(struct inode *inode, struct nfs_delegat
/* /*
* Return all delegations that have been marked for return * Return all delegations that have been marked for return
*/ */
static void nfs_client_return_marked_delegations(struct nfs_client *clp) void nfs_client_return_marked_delegations(struct nfs_client *clp)
{ {
struct nfs_delegation *delegation; struct nfs_delegation *delegation;
struct inode *inode; struct inode *inode;
...@@ -342,15 +342,16 @@ void nfs_super_return_all_delegations(struct super_block *sb) ...@@ -342,15 +342,16 @@ void nfs_super_return_all_delegations(struct super_block *sb)
nfs_client_return_marked_delegations(clp); nfs_client_return_marked_delegations(clp);
} }
static void nfs_client_return_all_delegations(struct nfs_client *clp) static void nfs_client_mark_return_all_delegations(struct nfs_client *clp)
{ {
struct nfs_delegation *delegation; struct nfs_delegation *delegation;
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(delegation, &clp->cl_delegations, super_list) list_for_each_entry_rcu(delegation, &clp->cl_delegations, super_list) {
set_bit(NFS_DELEGATION_RETURN, &delegation->flags); set_bit(NFS_DELEGATION_RETURN, &delegation->flags);
set_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state);
}
rcu_read_unlock(); rcu_read_unlock();
nfs_client_return_marked_delegations(clp);
} }
static int nfs_do_expire_all_delegations(void *ptr) static int nfs_do_expire_all_delegations(void *ptr)
...@@ -363,7 +364,8 @@ static int nfs_do_expire_all_delegations(void *ptr) ...@@ -363,7 +364,8 @@ static int nfs_do_expire_all_delegations(void *ptr)
goto out; goto out;
if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) == 0) if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) == 0)
goto out; goto out;
nfs_client_return_all_delegations(clp); nfs_client_mark_return_all_delegations(clp);
nfs_client_return_marked_delegations(clp);
out: out:
nfs_put_client(clp); nfs_put_client(clp);
module_put_and_exit(0); module_put_and_exit(0);
...@@ -392,7 +394,7 @@ void nfs_handle_cb_pathdown(struct nfs_client *clp) ...@@ -392,7 +394,7 @@ void nfs_handle_cb_pathdown(struct nfs_client *clp)
{ {
if (clp == NULL) if (clp == NULL)
return; return;
nfs_client_return_all_delegations(clp); nfs_client_mark_return_all_delegations(clp);
} }
struct recall_threadargs { struct recall_threadargs {
......
...@@ -40,6 +40,7 @@ struct inode *nfs_delegation_find_inode(struct nfs_client *clp, const struct nfs ...@@ -40,6 +40,7 @@ struct inode *nfs_delegation_find_inode(struct nfs_client *clp, const struct nfs
void nfs_super_return_all_delegations(struct super_block *sb); void nfs_super_return_all_delegations(struct super_block *sb);
void nfs_expire_all_delegations(struct nfs_client *clp); void nfs_expire_all_delegations(struct nfs_client *clp);
void nfs_handle_cb_pathdown(struct nfs_client *clp); void nfs_handle_cb_pathdown(struct nfs_client *clp);
void nfs_client_return_marked_delegations(struct nfs_client *clp);
void nfs_delegation_mark_reclaim(struct nfs_client *clp); void nfs_delegation_mark_reclaim(struct nfs_client *clp);
void nfs_delegation_reap_unclaimed(struct nfs_client *clp); void nfs_delegation_reap_unclaimed(struct nfs_client *clp);
......
...@@ -43,7 +43,7 @@ enum nfs4_client_state { ...@@ -43,7 +43,7 @@ enum nfs4_client_state {
NFS4CLNT_LEASE_EXPIRED, NFS4CLNT_LEASE_EXPIRED,
NFS4CLNT_RECLAIM_REBOOT, NFS4CLNT_RECLAIM_REBOOT,
NFS4CLNT_RECLAIM_NOGRACE, NFS4CLNT_RECLAIM_NOGRACE,
NFS4CLNT_CB_PATH_DOWN, NFS4CLNT_DELEGRETURN,
}; };
/* /*
......
...@@ -1027,7 +1027,7 @@ static void nfs4_recovery_handle_error(struct nfs_client *clp, int error) ...@@ -1027,7 +1027,7 @@ static void nfs4_recovery_handle_error(struct nfs_client *clp, int error)
{ {
switch (error) { switch (error) {
case -NFS4ERR_CB_PATH_DOWN: case -NFS4ERR_CB_PATH_DOWN:
set_bit(NFS4CLNT_CB_PATH_DOWN, &clp->cl_state); nfs_handle_cb_pathdown(clp);
break; break;
case -NFS4ERR_STALE_CLIENTID: case -NFS4ERR_STALE_CLIENTID:
case -NFS4ERR_LEASE_MOVED: case -NFS4ERR_LEASE_MOVED:
...@@ -1156,11 +1156,14 @@ static int reclaimer(void *ptr) ...@@ -1156,11 +1156,14 @@ static int reclaimer(void *ptr)
nfs4_state_end_reclaim_nograce(clp); nfs4_state_end_reclaim_nograce(clp);
continue; continue;
} }
if (test_and_clear_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state)) {
nfs_client_return_marked_delegations(clp);
continue;
}
break; break;
} }
out: out:
if (test_and_clear_bit(NFS4CLNT_CB_PATH_DOWN, &clp->cl_state))
nfs_handle_cb_pathdown(clp);
nfs4_clear_recover_bit(clp); nfs4_clear_recover_bit(clp);
nfs_put_client(clp); nfs_put_client(clp);
module_put_and_exit(0); module_put_and_exit(0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment