summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreivind <eivind@FreeBSD.org>1999-11-12 03:34:28 +0000
committereivind <eivind@FreeBSD.org>1999-11-12 03:34:28 +0000
commit21fff7b1c21bef91f4e2371aa79dee6d9c899b3d (patch)
treebbd7a274a33855ba0b75b1c22be91fb6dfc52472
parent9a30e94971558bbe2bf2f4450cfeb7f8dc8b5e89 (diff)
downloadFreeBSD-src-21fff7b1c21bef91f4e2371aa79dee6d9c899b3d.zip
FreeBSD-src-21fff7b1c21bef91f4e2371aa79dee6d9c899b3d.tar.gz
Remove WILLRELE from VOP_RENAME
-rw-r--r--sys/fs/unionfs/union_vnops.c3
-rw-r--r--sys/gnu/ext2fs/ext2_vnops.c9
-rw-r--r--sys/gnu/fs/ext2fs/ext2_vnops.c9
-rw-r--r--sys/kern/vfs_extattr.c6
-rw-r--r--sys/kern/vfs_syscalls.c6
-rw-r--r--sys/kern/vnode_if.src2
-rw-r--r--sys/miscfs/union/union_vnops.c3
-rw-r--r--sys/nfs/nfs_serv.c27
-rw-r--r--sys/nfsserver/nfs_serv.c27
-rw-r--r--sys/ufs/ufs/ufs_vnops.c8
10 files changed, 63 insertions, 37 deletions
diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c
index 0e74f39..a7af32b 100644
--- a/sys/fs/unionfs/union_vnops.c
+++ b/sys/fs/unionfs/union_vnops.c
@@ -705,8 +705,7 @@ union_mknod(ap)
if ((dvp = union_lock_upper(dun, cnp->cn_proc)) != NULL) {
struct vnode *vp;
- error = VOP_MKNOD(dvp, &vp, cnp, ap->a_vap);
- /* vp is garbage whether an error occurs or not */
+ error = VOP_MKNOD(dvp, ap->a_vpp, cnp, ap->a_vap);
union_unlock_upper(dvp, cnp->cn_proc);
}
return (error);
diff --git a/sys/gnu/ext2fs/ext2_vnops.c b/sys/gnu/ext2fs/ext2_vnops.c
index 82eedd8..ee64c44 100644
--- a/sys/gnu/ext2fs/ext2_vnops.c
+++ b/sys/gnu/ext2fs/ext2_vnops.c
@@ -43,6 +43,7 @@
*
* @(#)ufs_vnops.c 8.27 (Berkeley) 5/27/95
* @(#)ext2_vnops.c 8.7 (Berkeley) 2/3/94
+ * $FreeBSD$
*/
#include "opt_quota.h"
@@ -262,14 +263,18 @@ ext2_mknod(ap)
ip->i_rdev = vap->va_rdev;
}
/*
- * Remove inode so that it will be reloaded by VFS_VGET and
+ * Remove inode, then reload it through VFS_VGET so it is
* checked to see if it is an alias of an existing entry in
* the inode cache.
*/
vput(*vpp);
(*vpp)->v_type = VNON;
vgone(*vpp);
- *vpp = 0;
+ error = VFS_VGET(ap->a_dvp->v_mount, ip->i_ino, vpp);
+ if (error) {
+ *vpp = NULL;
+ return (error);
+ }
return (0);
}
diff --git a/sys/gnu/fs/ext2fs/ext2_vnops.c b/sys/gnu/fs/ext2fs/ext2_vnops.c
index 82eedd8..ee64c44 100644
--- a/sys/gnu/fs/ext2fs/ext2_vnops.c
+++ b/sys/gnu/fs/ext2fs/ext2_vnops.c
@@ -43,6 +43,7 @@
*
* @(#)ufs_vnops.c 8.27 (Berkeley) 5/27/95
* @(#)ext2_vnops.c 8.7 (Berkeley) 2/3/94
+ * $FreeBSD$
*/
#include "opt_quota.h"
@@ -262,14 +263,18 @@ ext2_mknod(ap)
ip->i_rdev = vap->va_rdev;
}
/*
- * Remove inode so that it will be reloaded by VFS_VGET and
+ * Remove inode, then reload it through VFS_VGET so it is
* checked to see if it is an alias of an existing entry in
* the inode cache.
*/
vput(*vpp);
(*vpp)->v_type = VNON;
vgone(*vpp);
- *vpp = 0;
+ error = VFS_VGET(ap->a_dvp->v_mount, ip->i_ino, vpp);
+ if (error) {
+ *vpp = NULL;
+ return (error);
+ }
return (0);
}
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c
index c1f21e7..62252b4 100644
--- a/sys/kern/vfs_extattr.c
+++ b/sys/kern/vfs_extattr.c
@@ -1142,6 +1142,9 @@ mknod(p, uap)
} else {
error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp,
&nd.ni_cnd, &vattr);
+ if (error == 0) {
+ vput(nd.ni_vp);
+ }
vput(nd.ni_dvp);
}
} else {
@@ -1197,6 +1200,9 @@ mkfifo(p, uap)
vattr.va_mode = (SCARG(uap, mode) & ALLPERMS) &~ p->p_fd->fd_cmask;
VOP_LEASE(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE);
error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr);
+ if (error == 0) {
+ vput(nd.ni_vp);
+ }
vput(nd.ni_dvp);
return (error);
}
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index c1f21e7..62252b4 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1142,6 +1142,9 @@ mknod(p, uap)
} else {
error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp,
&nd.ni_cnd, &vattr);
+ if (error == 0) {
+ vput(nd.ni_vp);
+ }
vput(nd.ni_dvp);
}
} else {
@@ -1197,6 +1200,9 @@ mkfifo(p, uap)
vattr.va_mode = (SCARG(uap, mode) & ALLPERMS) &~ p->p_fd->fd_cmask;
VOP_LEASE(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE);
error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr);
+ if (error == 0) {
+ vput(nd.ni_vp);
+ }
vput(nd.ni_dvp);
return (error);
}
diff --git a/sys/kern/vnode_if.src b/sys/kern/vnode_if.src
index b2c414a..e2cd43e 100644
--- a/sys/kern/vnode_if.src
+++ b/sys/kern/vnode_if.src
@@ -109,7 +109,7 @@ vop_whiteout {
#
vop_mknod {
IN struct vnode *dvp;
- OUT WILLRELE struct vnode **vpp;
+ OUT struct vnode **vpp;
IN struct componentname *cnp;
IN struct vattr *vap;
};
diff --git a/sys/miscfs/union/union_vnops.c b/sys/miscfs/union/union_vnops.c
index 0e74f39..a7af32b 100644
--- a/sys/miscfs/union/union_vnops.c
+++ b/sys/miscfs/union/union_vnops.c
@@ -705,8 +705,7 @@ union_mknod(ap)
if ((dvp = union_lock_upper(dun, cnp->cn_proc)) != NULL) {
struct vnode *vp;
- error = VOP_MKNOD(dvp, &vp, cnp, ap->a_vap);
- /* vp is garbage whether an error occurs or not */
+ error = VOP_MKNOD(dvp, ap->a_vpp, cnp, ap->a_vap);
union_unlock_upper(dvp, cnp->cn_proc);
}
return (error);
diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c
index c3ace8c..681c3a6 100644
--- a/sys/nfs/nfs_serv.c
+++ b/sys/nfs/nfs_serv.c
@@ -68,11 +68,11 @@
* error occurs. If no error occurs, the VOP_*() routines only free
* the path component if SAVESTART is NOT set.
*
- * Certain VOP calls (VOP_SYMLINK, VOP_MKNOD), lookup(), and namei()
+ * VOP_SYMLINK, lookup(), and namei()
* may return garbage in various structural fields/return elements
* if an error is returned, and may garbage up nd.ni_dvp even if no
* error is returned and you did not request LOCKPARENT or WANTPARENT.
- * VOP_SYMLINK/VOP_MKNOD return garbage in their return vnode (i.e. not
+ * VOP_SYMLINK return garbage in its return vnode (i.e. not
* something we need to release) even if no error occurs. Our cleanup
* code is sensitive to garbage, so we have to carefully clear it out.
*
@@ -1694,18 +1694,19 @@ nfsrv_create(nfsd, slp, procp, mrq)
vap->va_rdev = rdev;
nqsrv_getl(nd.ni_dvp, ND_WRITE);
- /*
- * VOP_MKNOD returns nd.ni_vp but already releases it,
- * so we just NULL the pointer.
- */
error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap);
- nd.ni_vp = NULL;
if (error) {
nd.ni_cnd.cn_flags &= ~HASBUF;
goto nfsmreply0;
}
/*
+ * release vp we do not use
+ */
+ vput(nd.ni_vp);
+ nd.ni_vp = NULL;
+
+ /*
* release dvp prior to lookup
*/
vput(nd.ni_dvp);
@@ -1906,19 +1907,19 @@ nfsrv_mknod(nfsd, slp, procp, mrq)
goto out;
nqsrv_getl(nd.ni_dvp, ND_WRITE);
- /*
- * VOP_MKNOD does not return a referenced or locked nd.ni_vp,
- * but it may set it to (in my view) garbage.
- */
error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap);
- nd.ni_vp = NULL;
-
if (error) {
nd.ni_cnd.cn_flags &= ~HASBUF;
goto out;
}
/*
+ * release vp we do not use
+ */
+ vput(nd.ni_vp);
+ nd.ni_vp = NULL;
+
+ /*
* Release dvp prior to lookup
*/
vput(nd.ni_dvp);
diff --git a/sys/nfsserver/nfs_serv.c b/sys/nfsserver/nfs_serv.c
index c3ace8c..681c3a6 100644
--- a/sys/nfsserver/nfs_serv.c
+++ b/sys/nfsserver/nfs_serv.c
@@ -68,11 +68,11 @@
* error occurs. If no error occurs, the VOP_*() routines only free
* the path component if SAVESTART is NOT set.
*
- * Certain VOP calls (VOP_SYMLINK, VOP_MKNOD), lookup(), and namei()
+ * VOP_SYMLINK, lookup(), and namei()
* may return garbage in various structural fields/return elements
* if an error is returned, and may garbage up nd.ni_dvp even if no
* error is returned and you did not request LOCKPARENT or WANTPARENT.
- * VOP_SYMLINK/VOP_MKNOD return garbage in their return vnode (i.e. not
+ * VOP_SYMLINK return garbage in its return vnode (i.e. not
* something we need to release) even if no error occurs. Our cleanup
* code is sensitive to garbage, so we have to carefully clear it out.
*
@@ -1694,18 +1694,19 @@ nfsrv_create(nfsd, slp, procp, mrq)
vap->va_rdev = rdev;
nqsrv_getl(nd.ni_dvp, ND_WRITE);
- /*
- * VOP_MKNOD returns nd.ni_vp but already releases it,
- * so we just NULL the pointer.
- */
error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap);
- nd.ni_vp = NULL;
if (error) {
nd.ni_cnd.cn_flags &= ~HASBUF;
goto nfsmreply0;
}
/*
+ * release vp we do not use
+ */
+ vput(nd.ni_vp);
+ nd.ni_vp = NULL;
+
+ /*
* release dvp prior to lookup
*/
vput(nd.ni_dvp);
@@ -1906,19 +1907,19 @@ nfsrv_mknod(nfsd, slp, procp, mrq)
goto out;
nqsrv_getl(nd.ni_dvp, ND_WRITE);
- /*
- * VOP_MKNOD does not return a referenced or locked nd.ni_vp,
- * but it may set it to (in my view) garbage.
- */
error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap);
- nd.ni_vp = NULL;
-
if (error) {
nd.ni_cnd.cn_flags &= ~HASBUF;
goto out;
}
/*
+ * release vp we do not use
+ */
+ vput(nd.ni_vp);
+ nd.ni_vp = NULL;
+
+ /*
* Release dvp prior to lookup
*/
vput(nd.ni_dvp);
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
index 772987b..6e394c1 100644
--- a/sys/ufs/ufs/ufs_vnops.c
+++ b/sys/ufs/ufs/ufs_vnops.c
@@ -223,14 +223,18 @@ ufs_mknod(ap)
ip->i_rdev = vap->va_rdev;
}
/*
- * Remove inode so that it will be reloaded by VFS_VGET and
+ * Remove inode, then reload it through VFS_VGET so it is
* checked to see if it is an alias of an existing entry in
* the inode cache.
*/
vput(*vpp);
(*vpp)->v_type = VNON;
vgone(*vpp);
- *vpp = 0;
+ error = VFS_VGET(ap->a_dvp->v_mount, ip->i_ino, vpp);
+ if (error) {
+ *vpp = NULL;
+ return (error);
+ }
return (0);
}
OpenPOWER on IntegriCloud