summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 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:;
OpenPOWER on IntegriCloud