aboutsummaryrefslogtreecommitdiff
path: root/sys/fs/portalfs
diff options
context:
space:
mode:
authorTim J. Robbins <tjr@FreeBSD.org>2003-01-05 00:46:01 +0000
committerTim J. Robbins <tjr@FreeBSD.org>2003-01-05 00:46:01 +0000
commita3ebcd98e15db58353d22cd5f5a79b4f990c13d4 (patch)
tree704c390f816351c8b1e289d04c2fdf02836c00e6 /sys/fs/portalfs
parentc41a3921ef876093daeeff9a71acc5f84294962d (diff)
downloadsrc-a3ebcd98e15db58353d22cd5f5a79b4f990c13d4.tar.gz
src-a3ebcd98e15db58353d22cd5f5a79b4f990c13d4.zip
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)
Notes
Notes: svn path=/head/; revision=108692
Diffstat (limited to 'sys/fs/portalfs')
-rw-r--r--sys/fs/portalfs/portal_vnops.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/fs/portalfs/portal_vnops.c b/sys/fs/portalfs/portal_vnops.c
index f6973ecbc12b..3241ff9dda47 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:;