summaryrefslogtreecommitdiff
path: root/sys/kern/vfs_lookup.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/vfs_lookup.c')
-rw-r--r--sys/kern/vfs_lookup.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
index aa86b97412e..4fee676eeaa 100644
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_lookup.c,v 1.9 1997/10/06 15:12:40 csapuntz Exp $ */
+/* $OpenBSD: vfs_lookup.c,v 1.10 1997/10/06 20:20:11 deraadt Exp $ */
/* $NetBSD: vfs_lookup.c,v 1.17 1996/02/09 19:00:59 christos Exp $ */
/*
@@ -88,7 +88,6 @@ namei(ndp)
struct uio auio;
int error, linklen;
struct componentname *cnp = &ndp->ni_cnd;
- struct proc *p = cnp->cn_proc;
ndp->ni_cnd.cn_cred = ndp->ni_cnd.cn_proc->p_ucred;
#ifdef DIAGNOSTIC
@@ -165,7 +164,7 @@ namei(ndp)
return (0);
}
if ((cnp->cn_flags & LOCKPARENT) && ndp->ni_pathlen == 1)
- VOP_UNLOCK(ndp->ni_dvp, 0, p);
+ VOP_UNLOCK(ndp->ni_dvp);
if (ndp->ni_loopcnt++ >= MAXSYMLINKS) {
error = ELOOP;
break;
@@ -272,7 +271,7 @@ lookup(ndp)
int error = 0;
int slashes;
struct componentname *cnp = &ndp->ni_cnd;
- struct proc *p = cnp->cn_proc;
+
/*
* Setup: break out flag bits into variables.
*/
@@ -286,7 +285,7 @@ lookup(ndp)
cnp->cn_flags &= ~ISSYMLINK;
dp = ndp->ni_startdir;
ndp->ni_startdir = NULLVP;
- vn_lock(dp, LK_EXCLUSIVE | LK_RETRY, p);
+ VOP_LOCK(dp);
/*
* If we have a leading string of slashes, remove them, and just make
@@ -411,7 +410,7 @@ dirloop:
dp = dp->v_mount->mnt_vnodecovered;
vput(tdp);
VREF(dp);
- vn_lock(dp, LK_EXCLUSIVE | LK_RETRY, p);
+ VOP_LOCK(dp);
}
}
@@ -420,7 +419,6 @@ dirloop:
*/
unionlookup:
ndp->ni_dvp = dp;
- ndp->ni_vp = NULL;
if ((error = VOP_LOOKUP(dp, &ndp->ni_vp, cnp)) != 0) {
#ifdef DIAGNOSTIC
if (ndp->ni_vp != NULL)
@@ -436,7 +434,7 @@ unionlookup:
dp = dp->v_mount->mnt_vnodecovered;
vput(tdp);
VREF(dp);
- vn_lock(dp, LK_EXCLUSIVE | LK_RETRY, p);
+ VOP_LOCK(dp);
goto unionlookup;
}
@@ -493,11 +491,12 @@ unionlookup:
*/
while (dp->v_type == VDIR && (mp = dp->v_mountedhere) &&
(cnp->cn_flags & NOCROSSMOUNT) == 0) {
- if (vfs_busy(mp, 0, 0, p))
+ if (mp->mnt_flag & MNT_MLOCK) {
+ mp->mnt_flag |= MNT_MWAIT;
+ sleep((caddr_t)mp, PVFS);
continue;
- error = VFS_ROOT(mp, &tdp);
- vfs_unbusy(mp, p);
- if (error)
+ }
+ if ((error = VFS_ROOT(dp->v_mountedhere, &tdp)) != 0)
goto bad2;
vput(dp);
ndp->ni_vp = dp = tdp;
@@ -559,12 +558,12 @@ terminal:
vrele(ndp->ni_dvp);
}
if ((cnp->cn_flags & LOCKLEAF) == 0)
- VOP_UNLOCK(dp, 0, p);
+ VOP_UNLOCK(dp);
return (0);
bad2:
if ((cnp->cn_flags & LOCKPARENT) && (cnp->cn_flags & ISLASTCN))
- VOP_UNLOCK(ndp->ni_dvp, 0, p);
+ VOP_UNLOCK(ndp->ni_dvp);
vrele(ndp->ni_dvp);
bad:
vput(dp);
@@ -580,7 +579,6 @@ relookup(dvp, vpp, cnp)
struct vnode *dvp, **vpp;
struct componentname *cnp;
{
- struct proc *p = cnp->cn_proc;
register struct vnode *dp = 0; /* the directory we are searching */
int docache; /* == 0 do not cache last component */
int wantparent; /* 1 => wantparent or lockparent flag */
@@ -602,7 +600,7 @@ relookup(dvp, vpp, cnp)
rdonly = cnp->cn_flags & RDONLY;
cnp->cn_flags &= ~ISSYMLINK;
dp = dvp;
- vn_lock(dp, LK_EXCLUSIVE | LK_RETRY, p);
+ VOP_LOCK(dp);
/* dirloop: */
/*
@@ -696,17 +694,15 @@ relookup(dvp, vpp, cnp)
if (!wantparent)
vrele(dvp);
if ((cnp->cn_flags & LOCKLEAF) == 0)
- VOP_UNLOCK(dp, 0, p);
+ VOP_UNLOCK(dp);
return (0);
bad2:
if ((cnp->cn_flags & LOCKPARENT) && (cnp->cn_flags & ISLASTCN))
- VOP_UNLOCK(dvp, 0, p);
+ VOP_UNLOCK(dvp);
vrele(dvp);
bad:
vput(dp);
*vpp = NULL;
return (error);
}
-
-