Update nwfs_lookup() to match the current cache_lookup() API.
cache_lookup() has returned a ref'ed and locked vnode since vfs_cache.c:1.96, dated Tue Mar 29 12:59:06 2005 UTC. This change is similar to the change made to smbfs_lookup() in smbfs_vnops.c:1.58. Tested by: "Antony Mawer" ant AT mawer.org MFC after: 2 weeks
This commit is contained in:
parent
3554cddbfa
commit
8bcc0d3f95
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=151394
@ -874,34 +874,19 @@ printf("dvp %d:%d:%d\n", (int)mp, (int)dvp->v_vflag & VV_ROOT, (int)flags & ISDO
|
||||
if (error) { /* name was found */
|
||||
struct vattr vattr;
|
||||
|
||||
vhold(*vpp);
|
||||
vp = *vpp;
|
||||
if (dvp == vp) { /* lookup on current */
|
||||
vref(vp);
|
||||
error = 0;
|
||||
NCPVNDEBUG("cached '.'");
|
||||
} else if (flags & ISDOTDOT) {
|
||||
VOP_UNLOCK(dvp, 0, td); /* unlock parent */
|
||||
error = vget(vp, LK_EXCLUSIVE, td);
|
||||
vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, td);
|
||||
} else
|
||||
error = vget(vp, LK_EXCLUSIVE, td);
|
||||
if (!error) {
|
||||
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);
|
||||
if (vp != dvp)
|
||||
vput(vp);
|
||||
else
|
||||
vrele(vp);
|
||||
if (VOP_GETATTR(vp, &vattr, cnp->cn_cred, td) == 0 &&
|
||||
vattr.va_ctime.tv_sec == VTONW(vp)->n_ctime) {
|
||||
if (nameiop != LOOKUP && islastcn)
|
||||
cnp->cn_flags |= SAVENAME;
|
||||
NCPVNDEBUG("use cached vnode");
|
||||
return (0);
|
||||
}
|
||||
vdrop(vp);
|
||||
cache_purge(vp);
|
||||
if (vp != dvp)
|
||||
vput(vp);
|
||||
else
|
||||
vrele(vp);
|
||||
*vpp = NULLVP;
|
||||
}
|
||||
/* not in cache, so ... */
|
||||
|
Loading…
Reference in New Issue
Block a user