summaryrefslogtreecommitdiffstats
path: root/sys/fs/nwfs
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2005-02-22 15:06:30 +0000
committerphk <phk@FreeBSD.org>2005-02-22 15:06:30 +0000
commitef9c88d1506f8edc31f314cc3a142fb14af594e5 (patch)
treef3ff566b979625e2dc748fbda39a305c42f91452 /sys/fs/nwfs
parent266c8910e6e289a9b9850247e3302423cab994ad (diff)
downloadFreeBSD-src-ef9c88d1506f8edc31f314cc3a142fb14af594e5.zip
FreeBSD-src-ef9c88d1506f8edc31f314cc3a142fb14af594e5.tar.gz
vp->v_id is a private field for the vfs namecache and it is a big mistake
that NFS ever started using it and an even bigger that it got copied&pasted to nwfs and smbfs. Replace with use of vhold()/vdrop().
Diffstat (limited to 'sys/fs/nwfs')
-rw-r--r--sys/fs/nwfs/nwfs_vnops.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/sys/fs/nwfs/nwfs_vnops.c b/sys/fs/nwfs/nwfs_vnops.c
index 6f719f1..4069e36 100644
--- a/sys/fs/nwfs/nwfs_vnops.c
+++ b/sys/fs/nwfs/nwfs_vnops.c
@@ -875,10 +875,9 @@ printf("dvp %d:%d:%d\n", (int)mp, (int)dvp->v_vflag & VV_ROOT, (int)flags & ISDO
return error;
if (error) { /* name was found */
struct vattr vattr;
- int vpid;
+ vhold(*vpp);
vp = *vpp;
- vpid = vp->v_id;
if (dvp == vp) { /* lookup on current */
vref(vp);
error = 0;
@@ -894,20 +893,20 @@ printf("dvp %d:%d:%d\n", (int)mp, (int)dvp->v_vflag & VV_ROOT, (int)flags & ISDO
VOP_UNLOCK(dvp, 0, td);
}
if (!error) {
- if (vpid == vp->v_id) {
- if (!VOP_GETATTR(vp, &vattr, cnp->cn_cred, td)
- && vattr.va_ctime.tv_sec == VTONW(vp)->n_ctime) {
- if (nameiop != LOOKUP && islastcn)
- cnp->cn_flags |= SAVENAME;
- NCPVNDEBUG("use cached vnode");
- return (0);
- }
- cache_purge(vp);
+ if (!VOP_GETATTR(vp, &vattr, cnp->cn_cred, td)
+ && vattr.va_ctime.tv_sec == VTONW(vp)->n_ctime) {
+ if (nameiop != LOOKUP && islastcn)
+ cnp->cn_flags |= SAVENAME;
+ NCPVNDEBUG("use cached vnode");
+ vdrop(vp);
+ return (0);
}
+ cache_purge(vp);
vput(vp);
if (lockparent && dvp != vp && islastcn)
VOP_UNLOCK(dvp, 0, td);
}
+ vdrop(vp);
error = vn_lock(dvp, LK_EXCLUSIVE, td);
*vpp = NULLVP;
if (error)
OpenPOWER on IntegriCloud