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

The st_vfs_file field *must* be non-NULL as long as the stateid is in use, so
there's no point testing for it, unless we want to just BUG().  But since we'd
immediately hit a NULL dereference in every case, there's no need even for
that.

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 |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

diff -puN fs/nfsd/nfs4state.c~nfsd4-remove-st_vfs_file-checks fs/nfsd/nfs4state.c
--- 25/fs/nfsd/nfs4state.c~nfsd4-remove-st_vfs_file-checks	2005-03-07 23:55:52.000000000 -0800
+++ 25-akpm/fs/nfsd/nfs4state.c	2005-03-07 23:55:52.000000000 -0800
@@ -1171,7 +1171,7 @@ release_stateid(struct nfs4_stateid *stp
 	list_del_perfile++;
 	list_del(&stp->st_perfile);
 	list_del(&stp->st_perfilestate);
-	if ((stp->st_vfs_file) && (flags & OPEN_STATE)) {
+	if (flags & OPEN_STATE) {
 		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)) {
@@ -1182,7 +1182,7 @@ release_stateid(struct nfs4_stateid *stp
 		release_stateid_lockowners(stp);
 		nfsd_close(stp->st_vfs_file);
 		vfsclose++;
-	} else if ((stp->st_vfs_file) && (flags & LOCK_STATE)) {
+	} else if (flags & LOCK_STATE) {
 		struct file *filp = stp->st_vfs_file;
 
 		locks_remove_posix(filp, (fl_owner_t) stp->st_stateowner);
@@ -1921,8 +1921,7 @@ find_openstateowner_id(u32 st_id, int fl
 static inline int
 nfs4_check_fh(struct svc_fh *fhp, struct nfs4_stateid *stp)
 {
-	return (stp->st_vfs_file == NULL ||
-		fhp->fh_dentry->d_inode != stp->st_vfs_file->f_dentry->d_inode);
+	return fhp->fh_dentry->d_inode != stp->st_vfs_file->f_dentry->d_inode;
 }
 
 static int
@@ -3015,10 +3014,8 @@ nfsd4_release_lockowner(struct svc_rqst 
 		status = nfserr_locks_held;
 		list_for_each_entry(stp, &local->so_perfilestate,
 				st_perfilestate) {
-			if (stp->st_vfs_file) {
-				if (check_for_locks(stp->st_vfs_file, local))
-					goto out;
-			}
+			if (check_for_locks(stp->st_vfs_file, local))
+				goto out;
 		}
 		/* no locks held by (lock) stateowner */
 		status = nfs_ok;
_