summaryrefslogtreecommitdiff
path: root/sys/tmpfs
diff options
context:
space:
mode:
authorVisa Hankala <visa@cvs.openbsd.org>2018-05-28 16:02:09 +0000
committerVisa Hankala <visa@cvs.openbsd.org>2018-05-28 16:02:09 +0000
commit8b9d60a1477a92a1f375d9214f4ff81721c74903 (patch)
treee93171b8a814abf6ba7d2465dae523e2b47c3a90 /sys/tmpfs
parentb485ccecaf69421e50bdbe6d2225584c57ef77b8 (diff)
Call vput(dvp) in vnode operation functions instead of calling it in
the file allocation routine. This allows stepwise changing of the vnode locking discipline. OK mpi@
Diffstat (limited to 'sys/tmpfs')
-rw-r--r--sys/tmpfs/tmpfs_subr.c3
-rw-r--r--sys/tmpfs/tmpfs_vnops.c14
2 files changed, 12 insertions, 5 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);