Remove WILLRELE from VOP_RENAME
This commit is contained in:
parent
0e46cd3e22
commit
edfe736df9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=53101
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -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);
|
||||
|
@ -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,17 +1694,18 @@ 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
|
||||
*/
|
||||
@ -1906,18 +1907,18 @@ 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
|
||||
*/
|
||||
|
@ -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,17 +1694,18 @@ 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
|
||||
*/
|
||||
@ -1906,18 +1907,18 @@ 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
|
||||
*/
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user