From: NeilBrown <neilb@cse.unsw.edu.au>

The only reason we're keeping a pointer to the stateid in the delegation is so
we can get at st_vfs_file.  So we should just keep a pointer to the struct
file instead.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/fs/nfsd/nfs4state.c        |   15 +++++++--------
 25-akpm/include/linux/nfsd/state.h |    2 +-
 2 files changed, 8 insertions(+), 9 deletions(-)

diff -puN fs/nfsd/nfs4state.c~nfsd4-store-file-with-deleg fs/nfsd/nfs4state.c
--- 25/fs/nfsd/nfs4state.c~nfsd4-store-file-with-deleg	2005-03-07 23:55:57.000000000 -0800
+++ 25-akpm/fs/nfsd/nfs4state.c	2005-03-07 23:55:57.000000000 -0800
@@ -145,7 +145,7 @@ alloc_init_deleg(struct nfs4_client *clp
 	dp->dl_client = clp;
 	dp->dl_file = fp;
 	dp->dl_flock = NULL;
-	dp->dl_stp = NULL;
+	dp->dl_vfs_file = NULL;
 	dp->dl_type = type;
 	dp->dl_recall.cbr_dp = NULL;
 	dp->dl_recall.cbr_ident = cb->cb_ident;
@@ -198,12 +198,10 @@ nfs4_put_delegation(struct nfs4_delegati
 static void
 nfs4_close_delegation(struct nfs4_delegation *dp)
 {
-	struct file *filp = dp->dl_stp->st_vfs_file;
+	struct file *filp = dp->dl_vfs_file;
 
 	dprintk("NFSD: close_delegation dp %p\n",dp);
-	release_stateid_lockowners(dp->dl_stp);
-	kfree(dp->dl_stp);
-	dp->dl_stp = NULL;
+	dp->dl_vfs_file = NULL;
 	atomic_set(&dp->dl_state, NFS4_RECALL_COMPLETE);
 	nfsd_close(filp);
 	vfsclose++;
@@ -214,9 +212,9 @@ static void
 release_delegation(struct nfs4_delegation *dp)
 {
 	/* delayed nfsd_close */
-	if (dp->dl_stp)
+	if (dp->dl_vfs_file)
 		nfs4_close_delegation(dp);
-	} else {
+	else {
 		dprintk("NFSD: release_delegation remove lease dl_flock %p\n",
 			dp->dl_flock);
 		remove_lease(dp->dl_flock);
@@ -1174,7 +1172,8 @@ release_stateid(struct nfs4_stateid *stp
 		list_for_each_entry(dp, &fp->fi_del_perfile, dl_del_perfile) {
 			if(cmp_clid(&dp->dl_client->cl_clientid,
 			    &stp->st_stateowner->so_client->cl_clientid)) {
-				dp->dl_stp = stp;
+				dp->dl_vfs_file = stp->st_vfs_file;
+				release_stateid_lockowners(stp);
 				return;
 			}
 		}
diff -puN include/linux/nfsd/state.h~nfsd4-store-file-with-deleg include/linux/nfsd/state.h
--- 25/include/linux/nfsd/state.h~nfsd4-store-file-with-deleg	2005-03-07 23:55:57.000000000 -0800
+++ 25-akpm/include/linux/nfsd/state.h	2005-03-07 23:55:57.000000000 -0800
@@ -91,7 +91,7 @@ struct nfs4_delegation {
 	struct nfs4_client	*dl_client;
 	struct nfs4_file	*dl_file;
 	struct file_lock	*dl_flock;
-	struct nfs4_stateid	*dl_stp;
+	struct file		*dl_vfs_file;
 	u32			dl_type;
 	time_t			dl_time;
 	struct nfs4_cb_recall	dl_recall;
_