delegation.c | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+) diff -u --recursive --new-file --show-c-function linux-2.6.7-12-delegation_recall/fs/nfs/delegation.c linux-2.6.7-13-delegation_recall2/fs/nfs/delegation.c --- linux-2.6.7-12-delegation_recall/fs/nfs/delegation.c 2004-06-08 01:54:47.000000000 -0400 +++ linux-2.6.7-13-delegation_recall2/fs/nfs/delegation.c 2004-06-08 02:01:36.000000000 -0400 @@ -40,6 +40,29 @@ void nfs_inode_set_delegation(struct ino spin_unlock(&clp->cl_lock); } +static void nfs_inode_reclaim_opens(struct inode *inode) +{ + struct nfs_inode *nfsi = NFS_I(inode); + struct nfs_open_context *pos; + struct nfs4_state *state; + +again: + spin_lock(&inode->i_lock); + list_for_each_entry(pos, &nfsi->open_files, open_files) { + state = pos->state; + if (state == NULL) + continue; + if (!test_bit(NFS_DELEGATED_STATE, &state->flags)) + continue; + get_nfs_open_context(pos); + spin_unlock(&inode->i_lock); + nfs4_open_delegation_recall(pos->dentry, state); + put_nfs_open_context(pos); + goto again; + } + spin_unlock(&inode->i_lock); +} + /* * Inform the world that we no longer possess a delegation */ @@ -71,6 +94,8 @@ int nfs_inode_return_delegation(struct i if (!nfs_inode_clear_delegation(inode)) return 0; nfs_wb_all(inode); + nfs_inode_reclaim_opens(inode); + nfs_wb_all(inode); /* In case we raced with open reclaim */ __nfs_revalidate_inode(NFS_SERVER(inode), inode); return nfs4_proc_delegreturn(inode); } struct inode *nfs_delegation_find_inode(struct nfs4_client *clp, const struct nfs_fh *fhandle)