From: NeilBrown From: "William A.(Andy) Adamson" Compare inode pointers instead of dentry pointers when checking an inode refered to by a stateid against an inode refered to by a file handle. Set st_vfs_set to 0 if the stateid/file handle check fails to avoid referencing bad state when reaping stateid's. --- fs/nfsd/nfs4state.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletion(-) diff -puN fs/nfsd/nfs4state.c~knfsd-nfs4-pointer-cleanup fs/nfsd/nfs4state.c --- 25/fs/nfsd/nfs4state.c~knfsd-nfs4-pointer-cleanup 2004-02-25 02:32:06.000000000 -0800 +++ 25-akpm/fs/nfsd/nfs4state.c 2004-02-25 02:32:06.000000000 -0800 @@ -1304,7 +1304,8 @@ find_openstateowner_id(u32 st_id) { static inline int nfs4_check_fh(struct svc_fh *fhp, struct nfs4_stateid *stp) { - return (fhp->fh_dentry != stp->st_vfs_file.f_dentry); + return (stp->st_vfs_set == 0 || + fhp->fh_dentry->d_inode != stp->st_vfs_file.f_dentry->d_inode); } static int @@ -1347,6 +1348,7 @@ nfs4_preprocess_stateid_op(struct svc_fh } if ((flags & CHECK_FH) && nfs4_check_fh(current_fh, stp)) { dprintk("NFSD: preprocess_stateid_op: fh-stateid mismatch!\n"); + stp->st_vfs_set = 0; goto out; } if (!stp->st_stateowner->so_confirmed) { @@ -1415,6 +1417,7 @@ nfs4_preprocess_seqid_op(struct svc_fh * if ((flags & CHECK_FH) && nfs4_check_fh(current_fh, stp)) { printk("NFSD: preprocess_seqid_op: fh-stateid mismatch!\n"); + stp->st_vfs_set = 0; goto out; } _