vp->v_id is a private field for the vfs namecache and it is a big mistake

that NFS ever started using it.  Long time ago I added the necessary
vhold()/vdrop() calls to replace it, but forgot to remove the v_id code.

Do it now.
This commit is contained in:
Poul-Henning Kamp 2005-02-22 14:52:00 +00:00
parent 1a1457d427
commit 33822d53bf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=142233

View File

@ -796,7 +796,6 @@ nfs_lookup(struct vop_lookup_args *ap)
np = VTONFS(dvp);
if ((error = cache_lookup(dvp, vpp, cnp)) && error != ENOENT) {
struct vattr vattr;
int vpid;
if ((error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, td)) != 0) {
*vpp = NULLVP;
@ -805,7 +804,6 @@ nfs_lookup(struct vop_lookup_args *ap)
vhold(*vpp);
newvp = *vpp;
vpid = newvp->v_id;
/*
* See the comment starting `Step through' in ufs/ufs_lookup.c
* for an explanation of the locking protocol
@ -830,18 +828,16 @@ nfs_lookup(struct vop_lookup_args *ap)
}
}
if (!error) {
if (vpid == newvp->v_id) {
if (!VOP_GETATTR(newvp, &vattr, cnp->cn_cred, td)
&& vattr.va_ctime.tv_sec == VTONFS(newvp)->n_ctime) {
nfsstats.lookupcache_hits++;
if (cnp->cn_nameiop != LOOKUP &&
(flags & ISLASTCN))
cnp->cn_flags |= SAVENAME;
vdrop(newvp);
return (0);
}
cache_purge(newvp);
if (!VOP_GETATTR(newvp, &vattr, cnp->cn_cred, td)
&& vattr.va_ctime.tv_sec == VTONFS(newvp)->n_ctime) {
nfsstats.lookupcache_hits++;
if (cnp->cn_nameiop != LOOKUP &&
(flags & ISLASTCN))
cnp->cn_flags |= SAVENAME;
vdrop(newvp);
return (0);
}
cache_purge(newvp);
vput(newvp);
if (lockparent && dvp != newvp && (flags & ISLASTCN))
VOP_UNLOCK(dvp, 0, td);