diff options
author | tjr <tjr@FreeBSD.org> | 2003-01-05 00:46:01 +0000 |
---|---|---|
committer | tjr <tjr@FreeBSD.org> | 2003-01-05 00:46:01 +0000 |
commit | 41e4abf4cc5c8ea394b16e090e3efbd4078cf53b (patch) | |
tree | 704c390f816351c8b1e289d04c2fdf02836c00e6 /sys/fs | |
parent | 4ba10a2319a6f9dbcdea9fc2876daaccd4b75b4a (diff) | |
download | FreeBSD-src-41e4abf4cc5c8ea394b16e090e3efbd4078cf53b.zip FreeBSD-src-41e4abf4cc5c8ea394b16e090e3efbd4078cf53b.tar.gz |
Repair vnode locking in portal_lookup(). Specifically, lock the file
vnode, and unlock the parent directory vnode if LOCKPARENT is not set.
Obtained from: NetBSD (rev. 1.34)
Diffstat (limited to 'sys/fs')
-rw-r--r-- | sys/fs/portalfs/portal_vnops.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/fs/portalfs/portal_vnops.c b/sys/fs/portalfs/portal_vnops.c index f6973ec..3241ff9 100644 --- a/sys/fs/portalfs/portal_vnops.c +++ b/sys/fs/portalfs/portal_vnops.c @@ -108,6 +108,7 @@ portal_lookup(ap) struct vnode **vpp = ap->a_vpp; struct vnode *dvp = ap->a_dvp; char *pname = cnp->cn_nameptr; + struct thread *td = cnp->cn_thread; struct portalnode *pt; int error; struct vnode *fvp = 0; @@ -122,7 +123,6 @@ portal_lookup(ap) if (cnp->cn_namelen == 1 && *pname == '.') { *vpp = dvp; VREF(dvp); - /*VOP_LOCK(dvp);*/ return (0); } @@ -156,7 +156,15 @@ portal_lookup(ap) pt->pt_fileid = portal_fileid++; *vpp = fvp; - /*VOP_LOCK(fvp);*/ + vn_lock(fvp, LK_EXCLUSIVE | LK_RETRY, td); + /* + * As we are the last component of the path name, fix up + * the locking on the directory node. + */ + if ((cnp->cn_flags & LOCKPARENT) == 0) { + VOP_UNLOCK(dvp, 0, td); + cnp->cn_flags |= PDIRUNLOCK; + } return (0); bad:; |