From: NeilBrown Just separate part of release_deleg into a separate function. Signed-off-by: J. Bruce Fields Signed-off-by: Neil Brown Signed-off-by: Andrew Morton --- 25-akpm/fs/nfsd/nfs4state.c | 28 +++++++++++++++++----------- 1 files changed, 17 insertions(+), 11 deletions(-) diff -puN fs/nfsd/nfs4state.c~nfsd4-reorganize-release_deleg fs/nfsd/nfs4state.c --- 25/fs/nfsd/nfs4state.c~nfsd4-reorganize-release_deleg 2005-03-07 23:55:56.000000000 -0800 +++ 25-akpm/fs/nfsd/nfs4state.c 2005-03-07 23:55:56.000000000 -0800 @@ -80,7 +80,6 @@ u32 free_delegation= 0; /* forward declarations */ struct nfs4_stateid * find_stateid(stateid_t *stid, int flags); static struct nfs4_delegation * find_delegation_stateid(struct inode *ino, stateid_t *stid); -static void release_delegation(struct nfs4_delegation *dp); static void release_stateid_lockowners(struct nfs4_stateid *open_stp); /* Locking: @@ -197,19 +196,26 @@ nfs4_put_delegation(struct nfs4_delegati */ static void +nfs4_close_delegation(struct nfs4_delegation *dp) +{ + struct file *filp = dp->dl_stp->st_vfs_file; + + dprintk("NFSD: close_delegation dp %p\n",dp); + release_stateid_lockowners(dp->dl_stp); + kfree(dp->dl_stp); + dp->dl_stp = NULL; + atomic_set(&dp->dl_state, NFS4_RECALL_COMPLETE); + nfsd_close(filp); + vfsclose++; +} + +/* Called under the state lock. */ +static void release_delegation(struct nfs4_delegation *dp) { /* delayed nfsd_close */ - if (dp->dl_stp) { - struct file *filp = dp->dl_stp->st_vfs_file; - - dprintk("NFSD: release_delegation CLOSE\n"); - release_stateid_lockowners(dp->dl_stp); - kfree(dp->dl_stp); - dp->dl_stp = NULL; - atomic_set(&dp->dl_state, NFS4_RECALL_COMPLETE); - nfsd_close(filp); - vfsclose++; + if (dp->dl_stp) + nfs4_close_delegation(dp); } else { dprintk("NFSD: release_delegation remove lease dl_flock %p\n", dp->dl_flock); _