summaryrefslogtreecommitdiffstats
path: root/sys/fs/nwfs
diff options
context:
space:
mode:
authortruckman <truckman@FreeBSD.org>2005-10-16 21:54:35 +0000
committertruckman <truckman@FreeBSD.org>2005-10-16 21:54:35 +0000
commit321926b9ba66498b2d26868cd262d5d05237d521 (patch)
treeb9692a2ba3bf2fc35ace7a49787f809acdb281c3 /sys/fs/nwfs
parentfa8ac582282505203d00979e1f89505ee3e59cc3 (diff)
downloadFreeBSD-src-321926b9ba66498b2d26868cd262d5d05237d521.zip
FreeBSD-src-321926b9ba66498b2d26868cd262d5d05237d521.tar.gz
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
Diffstat (limited to 'sys/fs/nwfs')
-rw-r--r--sys/fs/nwfs/nwfs_vnops.c37
1 files changed, 11 insertions, 26 deletions
diff --git a/sys/fs/nwfs/nwfs_vnops.c b/sys/fs/nwfs/nwfs_vnops.c
index 90f9c4e..1dd2ae5 100644
--- a/sys/fs/nwfs/nwfs_vnops.c
+++ b/sys/fs/nwfs/nwfs_vnops.c
@@ -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 ... */
OpenPOWER on IntegriCloud