summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/tmpfs/tmpfs_subr.c3
-rw-r--r--sys/tmpfs/tmpfs_vnops.c14
-rw-r--r--sys/ufs/ext2fs/ext2fs_vnops.c19
3 files changed, 23 insertions, 13 deletions
diff --git a/sys/tmpfs/tmpfs_subr.c b/sys/tmpfs/tmpfs_subr.c
index 3b9465107d1..d92d2f06f3a 100644
--- a/sys/tmpfs/tmpfs_subr.c
+++ b/sys/tmpfs/tmpfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmpfs_subr.c,v 1.21 2018/05/27 06:02:15 visa Exp $ */
+/* $OpenBSD: tmpfs_subr.c,v 1.22 2018/05/28 16:02:08 visa Exp $ */
/* $NetBSD: tmpfs_subr.c,v 1.79 2012/03/13 18:40:50 elad Exp $ */
/*
@@ -426,7 +426,6 @@ tmpfs_alloc_file(struct vnode *dvp, struct vnode **vpp, struct vattr *vap,
out:
if (error == 0 && (cnp->cn_flags & SAVESTART) == 0)
pool_put(&namei_pool, cnp->cn_pnbuf);
- vput(dvp);
return error;
}
diff --git a/sys/tmpfs/tmpfs_vnops.c b/sys/tmpfs/tmpfs_vnops.c
index 1937fd20ee1..5c06b4b788b 100644
--- a/sys/tmpfs/tmpfs_vnops.c
+++ b/sys/tmpfs/tmpfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmpfs_vnops.c,v 1.30 2018/05/23 14:49:08 reyk Exp $ */
+/* $OpenBSD: tmpfs_vnops.c,v 1.31 2018/05/28 16:02:08 visa Exp $ */
/* $NetBSD: tmpfs_vnops.c,v 1.100 2012/11/05 17:27:39 dholland Exp $ */
/*
@@ -317,11 +317,14 @@ tmpfs_create(void *v)
struct vnode *dvp = ap->a_dvp, **vpp = ap->a_vpp;
struct componentname *cnp = ap->a_cnp;
struct vattr *vap = ap->a_vap;
+ int error;
KASSERT(VOP_ISLOCKED(dvp));
KASSERT(cnp->cn_flags & HASBUF);
KASSERT(vap->va_type == VREG || vap->va_type == VSOCK);
- return tmpfs_alloc_file(dvp, vpp, vap, cnp, NULL);
+ error = tmpfs_alloc_file(dvp, vpp, vap, cnp, NULL);
+ vput(dvp);
+ return error;
}
int
@@ -346,6 +349,7 @@ tmpfs_mknod(void *v)
/* tmpfs_alloc_file() will unlock 'dvp'. */
error = tmpfs_alloc_file(dvp, vpp, vap, cnp, NULL);
+ vput(dvp);
if (error)
return error;
@@ -853,9 +857,12 @@ tmpfs_mkdir(void *v)
struct vnode **vpp = ap->a_vpp;
struct componentname *cnp = ap->a_cnp;
struct vattr *vap = ap->a_vap;
+ int error;
KASSERT(vap->va_type == VDIR);
- return tmpfs_alloc_file(dvp, vpp, vap, cnp, NULL);
+ error = tmpfs_alloc_file(dvp, vpp, vap, cnp, NULL);
+ vput(dvp);
+ return error;
}
int
@@ -962,6 +969,7 @@ tmpfs_symlink(void *v)
vap->va_type = VLNK;
error = tmpfs_alloc_file(dvp, vpp, vap, cnp, target);
+ vput(dvp);
if (error == 0)
vput(*vpp);
diff --git a/sys/ufs/ext2fs/ext2fs_vnops.c b/sys/ufs/ext2fs/ext2fs_vnops.c
index 117576a12e6..876030e9404 100644
--- a/sys/ufs/ext2fs/ext2fs_vnops.c
+++ b/sys/ufs/ext2fs/ext2fs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ext2fs_vnops.c,v 1.81 2018/05/02 02:24:56 visa Exp $ */
+/* $OpenBSD: ext2fs_vnops.c,v 1.82 2018/05/28 16:02:08 visa Exp $ */
/* $NetBSD: ext2fs_vnops.c,v 1.1 1997/06/11 09:34:09 bouyer Exp $ */
/*
@@ -80,9 +80,13 @@ int
ext2fs_create(void *v)
{
struct vop_create_args *ap = v;
- return ext2fs_makeinode(MAKEIMODE(ap->a_vap->va_type,
+ int error;
+
+ error = ext2fs_makeinode(MAKEIMODE(ap->a_vap->va_type,
ap->a_vap->va_mode),
ap->a_dvp, ap->a_vpp, ap->a_cnp);
+ vput(ap->a_dvp);
+ return (error);
}
/*
@@ -98,9 +102,10 @@ ext2fs_mknod(void *v)
struct inode *ip;
int error;
- if ((error =
- ext2fs_makeinode(MAKEIMODE(vap->va_type, vap->va_mode),
- ap->a_dvp, vpp, ap->a_cnp)) != 0)
+ error = ext2fs_makeinode(MAKEIMODE(vap->va_type, vap->va_mode),
+ ap->a_dvp, vpp, ap->a_cnp);
+ vput(ap->a_dvp);
+ if (error != 0)
return (error);
ip = VTOI(*vpp);
ip->i_flag |= IN_ACCESS | IN_CHANGE | IN_UPDATE;
@@ -1085,6 +1090,7 @@ ext2fs_symlink(void *v)
error = ext2fs_makeinode(IFLNK | ap->a_vap->va_mode, ap->a_dvp,
vpp, ap->a_cnp);
+ vput(ap->a_dvp);
if (error)
return (error);
vp = *vpp;
@@ -1180,7 +1186,6 @@ ext2fs_makeinode(int mode, struct vnode *dvp, struct vnode **vpp,
if ((error = ext2fs_inode_alloc(pdir, mode, cnp->cn_cred, &tvp))
!= 0) {
pool_put(&namei_pool, cnp->cn_pnbuf);
- vput(dvp);
return (error);
}
ip = VTOI(tvp);
@@ -1205,7 +1210,6 @@ ext2fs_makeinode(int mode, struct vnode *dvp, struct vnode **vpp,
goto bad;
if ((cnp->cn_flags & SAVESTART) == 0)
pool_put(&namei_pool, cnp->cn_pnbuf);
- vput(dvp);
*vpp = tvp;
return (0);
@@ -1215,7 +1219,6 @@ bad:
* or the directory so must deallocate the inode.
*/
pool_put(&namei_pool, cnp->cn_pnbuf);
- vput(dvp);
ip->i_e2fs_nlink = 0;
ip->i_flag |= IN_CHANGE;
tvp->v_type = VNON;