Index: tmpfs.h =================================================================== RCS file: /usr/repo/src/sys/fs/tmpfs/tmpfs.h,v retrieving revision 1.9 diff -u -p -r1.9 tmpfs.h --- tmpfs.h 3 Aug 2007 06:24:31 -0000 1.9 +++ tmpfs.h 3 Aug 2007 10:01:46 -0000 @@ -353,8 +353,8 @@ int tmpfs_alloc_dirent(struct tmpfs_moun const char *, uint16_t, struct tmpfs_dirent **); void tmpfs_free_dirent(struct tmpfs_mount *, struct tmpfs_dirent *, boolean_t); -int tmpfs_alloc_vp(struct mount *, struct tmpfs_node *, struct vnode **, - struct thread *td); +int tmpfs_alloc_vp(struct mount *, struct tmpfs_node *, int, + struct vnode **, struct thread *td); void tmpfs_free_vp(struct vnode *); int tmpfs_alloc_file(struct vnode *, struct vnode **, struct vattr *, struct componentname *, char *); Index: tmpfs_subr.c =================================================================== RCS file: /usr/repo/src/sys/fs/tmpfs/tmpfs_subr.c,v retrieving revision 1.10 diff -u -p -r1.10 tmpfs_subr.c --- tmpfs_subr.c 3 Aug 2007 06:24:31 -0000 1.10 +++ tmpfs_subr.c 3 Aug 2007 10:15:05 -0000 @@ -302,15 +302,15 @@ tmpfs_free_dirent(struct tmpfs_mount *tm * Returns zero on success or an appropriate error code on failure. */ int -tmpfs_alloc_vp(struct mount *mp, struct tmpfs_node *node, struct vnode **vpp, - struct thread *td) +tmpfs_alloc_vp(struct mount *mp, struct tmpfs_node *node, int lkflags, + struct vnode **vpp, struct thread *td) { int error; struct vnode *vp; loop: if ((vp = node->tn_vnode) != NULL) { - error = vget(vp, LK_EXCLUSIVE | LK_RETRY, td); + error = vget(vp, lkflags | LK_RETRY, td); if (error) return error; @@ -351,7 +351,7 @@ loop: goto unlock; MPASS(vp != NULL); - error = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); + error = vn_lock(vp, lkflags | LK_RETRY, td); if (error != 0) { vp->v_data = NULL; vput(vp); @@ -499,7 +499,8 @@ tmpfs_alloc_file(struct vnode *dvp, stru } /* Allocate a vnode for the new file. */ - error = tmpfs_alloc_vp(dvp->v_mount, node, vpp, cnp->cn_thread); + error = tmpfs_alloc_vp(dvp->v_mount, node, LK_EXCLUSIVE, vpp, + cnp->cn_thread); if (error != 0) { tmpfs_free_dirent(tmp, de, TRUE); tmpfs_free_node(tmp, node); Index: tmpfs_vfsops.c =================================================================== RCS file: /usr/repo/src/sys/fs/tmpfs/tmpfs_vfsops.c,v retrieving revision 1.8 diff -u -p -r1.8 tmpfs_vfsops.c --- tmpfs_vfsops.c 24 Jul 2007 17:14:53 -0000 1.8 +++ tmpfs_vfsops.c 3 Aug 2007 10:05:04 -0000 @@ -390,7 +390,7 @@ static int tmpfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) { int error; - error = tmpfs_alloc_vp(mp, VFS_TO_TMPFS(mp)->tm_root, vpp, td); + error = tmpfs_alloc_vp(mp, VFS_TO_TMPFS(mp)->tm_root, flags, vpp, td); if (!error) (*vpp)->v_vflag |= VV_ROOT; @@ -429,7 +429,9 @@ tmpfs_fhtovp(struct mount *mp, struct fi } TMPFS_UNLOCK(tmp); - return found ? tmpfs_alloc_vp(mp, node, vpp, curthread) : EINVAL; + if (found) + return (tmpfs_alloc_vp(mp, node, LK_EXCLUSIVE, vpp, curthread)); + return (EINVAL); } /* --------------------------------------------------------------------- */ Index: tmpfs_vnops.c =================================================================== RCS file: /usr/repo/src/sys/fs/tmpfs/tmpfs_vnops.c,v retrieving revision 1.8 diff -u -p -r1.8 tmpfs_vnops.c --- tmpfs_vnops.c 19 Jul 2007 03:34:50 -0000 1.8 +++ tmpfs_vnops.c 3 Aug 2007 10:06:28 -0000 @@ -95,12 +95,14 @@ tmpfs_lookup(struct vop_cachedlookup_arg !(cnp->cn_flags & ISDOTDOT))); if (cnp->cn_flags & ISDOTDOT) { - VOP_UNLOCK(dvp, 0, td); + int ltype = 0; + ltype = VOP_ISLOCKED(dvp, td); + VOP_UNLOCK(dvp, 0, td); /* Allocate a new vnode on the matching entry. */ - error = tmpfs_alloc_vp(dvp->v_mount, dnode->tn_dir.tn_parent, vpp, td); - - vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, td); + error = tmpfs_alloc_vp(dvp->v_mount, dnode->tn_dir.tn_parent, + cnp->cn_lkflags, vpp, td); + vn_lock(dvp, ltype | LK_RETRY, td); dnode->tn_dir.tn_parent->tn_lookup_dirent = NULL; } else if (cnp->cn_namelen == 1 && cnp->cn_nameptr[0] == '.') { @@ -160,7 +162,8 @@ tmpfs_lookup(struct vop_cachedlookup_arg goto out; /* Allocate a new vnode on the matching entry. */ - error = tmpfs_alloc_vp(dvp->v_mount, tnode, vpp, td); + error = tmpfs_alloc_vp(dvp->v_mount, tnode, + cnp->cn_lkflags, vpp, td); if (error != 0) goto out; @@ -174,10 +177,10 @@ tmpfs_lookup(struct vop_cachedlookup_arg } tnode->tn_lookup_dirent = de; cnp->cn_flags |= SAVENAME; + } else { + error = tmpfs_alloc_vp(dvp->v_mount, tnode, + cnp->cn_lkflags, vpp, td); } - else - error = tmpfs_alloc_vp(dvp->v_mount, tnode, vpp, td); - } }