Commit c79571a5 authored by Alexandros Batsakis's avatar Alexandros Batsakis Committed by Trond Myklebust

nfs4: V2 return/expire delegations depending on their type

Signed-off-by: default avatarAlexandros Batsakis <batsakis@netapp.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent b4a6f496
...@@ -385,29 +385,43 @@ void nfs_super_return_all_delegations(struct super_block *sb) ...@@ -385,29 +385,43 @@ void nfs_super_return_all_delegations(struct super_block *sb)
nfs4_schedule_state_manager(clp); nfs4_schedule_state_manager(clp);
} }
static void nfs_client_mark_return_all_delegations(struct nfs_client *clp) static
void nfs_client_mark_return_all_delegation_types(struct nfs_client *clp, fmode_t flags)
{ {
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) {
nfs_mark_return_delegation(clp, delegation); if ((delegation->type == (FMODE_READ|FMODE_WRITE)) && !(flags & FMODE_WRITE))
continue;
if (delegation->type & flags)
nfs_mark_return_delegation(clp, delegation);
} }
rcu_read_unlock(); rcu_read_unlock();
} }
static void nfs_client_mark_return_all_delegations(struct nfs_client *clp)
{
nfs_client_mark_return_all_delegation_types(clp, FMODE_READ|FMODE_WRITE);
}
static void nfs_delegation_run_state_manager(struct nfs_client *clp) static void nfs_delegation_run_state_manager(struct nfs_client *clp)
{ {
if (test_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state)) if (test_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state))
nfs4_schedule_state_manager(clp); nfs4_schedule_state_manager(clp);
} }
void nfs_expire_all_delegations(struct nfs_client *clp) static void nfs_expire_all_delegation_types(struct nfs_client *clp, fmode_t flags)
{ {
nfs_client_mark_return_all_delegations(clp); nfs_client_mark_return_all_delegation_types(clp, flags);
nfs_delegation_run_state_manager(clp); nfs_delegation_run_state_manager(clp);
} }
void nfs_expire_all_delegations(struct nfs_client *clp)
{
nfs_expire_all_delegation_types(clp, FMODE_READ|FMODE_WRITE);
}
/* /*
* Return all delegations following an NFS4ERR_CB_PATH_DOWN error. * Return all delegations following an NFS4ERR_CB_PATH_DOWN error.
*/ */
......
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