Commit 0a3b5d3b authored by Trond Myklebust's avatar Trond Myklebust

NFSv4: More delegation recall code

Signed-off-by: default avatarTrond Myklebust <trond.myklebust@fys.uio.no>
parent 3f052fdc
...@@ -30,6 +30,30 @@ static void nfs_free_delegation(struct nfs_delegation *delegation) ...@@ -30,6 +30,30 @@ static void nfs_free_delegation(struct nfs_delegation *delegation)
kfree(delegation); kfree(delegation);
} }
static void nfs_delegation_claim_opens(struct inode *inode)
{
struct nfs_inode *nfsi = NFS_I(inode);
struct nfs_open_context *ctx;
struct nfs4_state *state;
again:
spin_lock(&inode->i_lock);
list_for_each_entry(ctx, &nfsi->open_files, list) {
state = ctx->state;
if (state == NULL)
continue;
if (!test_bit(NFS_DELEGATED_STATE, &state->flags))
continue;
get_nfs_open_context(ctx);
spin_unlock(&inode->i_lock);
if (nfs4_open_delegation_recall(ctx->dentry, state) < 0)
return;
put_nfs_open_context(ctx);
goto again;
}
spin_unlock(&inode->i_lock);
}
/* /*
* Set up a delegation on an inode * Set up a delegation on an inode
*/ */
...@@ -110,6 +134,7 @@ int nfs_inode_return_delegation(struct inode *inode) ...@@ -110,6 +134,7 @@ int nfs_inode_return_delegation(struct inode *inode)
nfsi->delegation = NULL; nfsi->delegation = NULL;
} }
spin_unlock(&clp->cl_lock); spin_unlock(&clp->cl_lock);
nfs_delegation_claim_opens(inode);
up_write(&nfsi->rwsem); up_write(&nfsi->rwsem);
up_read(&clp->cl_sem); up_read(&clp->cl_sem);
nfs_msync_inode(inode); nfs_msync_inode(inode);
...@@ -182,6 +207,7 @@ static int recall_thread(void *data) ...@@ -182,6 +207,7 @@ static int recall_thread(void *data)
} }
spin_unlock(&clp->cl_lock); spin_unlock(&clp->cl_lock);
complete(&args->started); complete(&args->started);
nfs_delegation_claim_opens(inode);
up_write(&nfsi->rwsem); up_write(&nfsi->rwsem);
up_read(&clp->cl_sem); up_read(&clp->cl_sem);
nfs_msync_inode(inode); nfs_msync_inode(inode);
......
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