Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Change vnode operations create, mknod, mkdir and symlink to ...
details: https://anonhg.NetBSD.org/src/rev/e0415585f1fb
branches: trunk
changeset: 326071:e0415585f1fb
user: hannken <hannken%NetBSD.org@localhost>
date: Fri Jan 17 10:55:01 2014 +0000
description:
Change vnode operations create, mknod, mkdir and symlink to keep the
directory node dvp locked on return.
Discussed on tech-kern@
Welcome to 6.99.29
diffstat:
external/cddl/osnet/dist/uts/common/fs/zfs/zfs_replay.c | 2 +
external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c | 24 +----
lib/libp2k/p2k.c | 4 +-
share/man/man9/vnodeops.9 | 7 +-
sys/coda/coda_vnops.c | 25 +----
sys/fs/adosfs/advnops.c | 7 +-
sys/fs/cd9660/cd9660_vnops.c | 7 +-
sys/fs/filecorefs/filecore_vnops.c | 7 +-
sys/fs/msdosfs/msdosfs_vnops.c | 12 +-
sys/fs/nilfs/nilfs_vnops.c | 16 +--
sys/fs/puffs/puffs_vnops.c | 17 +--
sys/fs/smbfs/smbfs_vnops.c | 10 +-
sys/fs/sysvbfs/sysvbfs_vnops.c | 14 +--
sys/fs/tmpfs/tmpfs_subr.c | 5 +-
sys/fs/tmpfs/tmpfs_vnops.c | 12 +-
sys/fs/udf/udf_vnops.c | 16 +--
sys/fs/union/union_subr.c | 6 +-
sys/fs/union/union_vnops.c | 29 +-----
sys/fs/v7fs/v7fs_vnops.c | 37 ++-----
sys/kern/uipc_usrreq.c | 6 +-
sys/kern/vfs_syscalls.c | 9 +-
sys/kern/vfs_vnops.c | 5 +-
sys/kern/vnode_if.c | 48 +++++-----
sys/miscfs/deadfs/dead_vnops.c | 73 +----------------
sys/miscfs/fdesc/fdesc_vnops.c | 7 +-
sys/miscfs/kernfs/kernfs_vnops.c | 7 +-
sys/miscfs/procfs/procfs_vnops.c | 7 +-
sys/nfs/nfs_serv.c | 23 ++--
sys/nfs/nfs_vnops.c | 17 +--
sys/rump/include/rump/rumpvnode_if.h | 6 +-
sys/rump/librump/rumpvfs/rumpfs.c | 28 ++----
sys/rump/librump/rumpvfs/rumpvnode_if.c | 8 +-
sys/sys/param.h | 4 +-
sys/sys/vnode_if.h | 14 +-
sys/ufs/chfs/chfs_vnode.c | 5 +-
sys/ufs/chfs/chfs_vnops.c | 30 +++---
sys/ufs/ext2fs/ext2fs_vnops.c | 16 +--
sys/ufs/lfs/lfs_vnops.c | 16 +--
sys/ufs/lfs/ulfs_vnops.c | 16 +--
sys/ufs/ufs/ufs_vnops.c | 19 +---
40 files changed, 215 insertions(+), 406 deletions(-)
diffs (truncated from 2530 to 300 lines):
diff -r 67fbdb6ed0f5 -r e0415585f1fb external/cddl/osnet/dist/uts/common/fs/zfs/zfs_replay.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_replay.c Fri Jan 17 10:52:36 2014 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_replay.c Fri Jan 17 10:55:01 2014 +0000
@@ -321,6 +321,7 @@
if (lr->lr_common.lrc_txtype & TX_CI)
vflg |= FIGNORECASE;
+ vn_lock(ZTOV(dzp), LK_EXCLUSIVE | LK_RETRY);
switch (txtype) {
case TX_CREATE_ACL:
aclstart = (caddr_t)(lracl + 1);
@@ -395,6 +396,7 @@
default:
error = ENOTSUP;
}
+ VOP_UNLOCK(ZTOV(dzp));
bail:
if (error == 0 && vp != NULL)
diff -r 67fbdb6ed0f5 -r e0415585f1fb external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c Fri Jan 17 10:52:36 2014 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c Fri Jan 17 10:55:01 2014 +0000
@@ -4946,7 +4946,7 @@
static int
zfs_netbsd_create(void *v)
{
- struct vop_create_args /* {
+ struct vop_create_v2_args /* {
struct vnode *a_dvp;
struct vnode **a_vpp;
struct componentname *a_cnp;
@@ -4996,12 +4996,6 @@
KASSERT(VOP_ISLOCKED(dvp) == LK_EXCLUSIVE);
KASSERT((*vpp == NULL) || (VOP_ISLOCKED(*vpp) == LK_EXCLUSIVE));
- /*
- * Unlock and release dvp because the VOP_CREATE protocol is insane.
- */
- VOP_UNLOCK(dvp);
- VN_RELE(dvp);
-
return (error);
}
@@ -5057,7 +5051,7 @@
static int
zfs_netbsd_mkdir(void *v)
{
- struct vop_mkdir_args /* {
+ struct vop_mkdir_v2_args /* {
struct vnode *a_dvp;
struct vnode **a_vpp;
struct componentname *a_cnp;
@@ -5104,12 +5098,6 @@
KASSERT(VOP_ISLOCKED(dvp) == LK_EXCLUSIVE);
KASSERT((*vpp == NULL) || (VOP_ISLOCKED(*vpp) == LK_EXCLUSIVE));
- /*
- * Unlock and release dvp because the VOP_MKDIR protocol is insane.
- */
- VOP_UNLOCK(dvp);
- VN_RELE(dvp);
-
return (error);
}
@@ -5373,7 +5361,7 @@
static int
zfs_netbsd_symlink(void *v)
{
- struct vop_symlink_args /* {
+ struct vop_symlink_v2_args /* {
struct vnode *a_dvp;
struct vnode **a_vpp;
struct componentname *a_cnp;
@@ -5425,12 +5413,6 @@
KASSERT(VOP_ISLOCKED(dvp) == LK_EXCLUSIVE);
KASSERT((*vpp == NULL) || (VOP_ISLOCKED(*vpp) == LK_EXCLUSIVE));
- /*
- * Unlock and release dvp because the VOP_SYMLINK protocol is insane.
- */
- VOP_UNLOCK(dvp);
- VN_RELE(dvp);
-
return (error);
}
diff -r 67fbdb6ed0f5 -r e0415585f1fb lib/libp2k/p2k.c
--- a/lib/libp2k/p2k.c Fri Jan 17 10:52:36 2014 +0000
+++ b/lib/libp2k/p2k.c Fri Jan 17 10:55:01 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: p2k.c,v 1.60 2012/11/23 14:27:14 joerg Exp $ */
+/* $NetBSD: p2k.c,v 1.61 2014/01/17 10:55:01 hannken Exp $ */
/*
* Copyright (c) 2007, 2008, 2009 Antti Kantee. All Rights Reserved.
@@ -804,7 +804,7 @@
} else {
rv = symfn(dvp, &vp, cn, va_x, link_target);
}
- assert(RUMP_VOP_ISLOCKED(dvp) == 0);
+ RUMP_VOP_UNLOCK(dvp);
freecn(cn);
if (rv == 0) {
diff -r 67fbdb6ed0f5 -r e0415585f1fb share/man/man9/vnodeops.9
--- a/share/man/man9/vnodeops.9 Fri Jan 17 10:52:36 2014 +0000
+++ b/share/man/man9/vnodeops.9 Fri Jan 17 10:55:01 2014 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: vnodeops.9,v 1.89 2012/11/05 22:44:22 wiz Exp $
+.\" $NetBSD: vnodeops.9,v 1.90 2014/01/17 10:55:01 hannken Exp $
.\"
.\" Copyright (c) 2001, 2005, 2006 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -27,7 +27,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd November 5, 2012
+.Dd January 17, 2014
.Dt VNODEOPS 9
.Os
.Sh NAME
@@ -432,9 +432,6 @@
locked vnode is returned in
.Fa vpp
and zero is returned.
-Regardless of the return value, the directory vnode
-.Fa dvp
-will be unlocked on return.
.Pp
This function is called after
.Fn VOP_LOOKUP
diff -r 67fbdb6ed0f5 -r e0415585f1fb sys/coda/coda_vnops.c
--- a/sys/coda/coda_vnops.c Fri Jan 17 10:52:36 2014 +0000
+++ b/sys/coda/coda_vnops.c Fri Jan 17 10:55:01 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: coda_vnops.c,v 1.91 2013/10/17 20:55:30 christos Exp $ */
+/* $NetBSD: coda_vnops.c,v 1.92 2014/01/17 10:55:01 hannken Exp $ */
/*
*
@@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.91 2013/10/17 20:55:30 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.92 2014/01/17 10:55:01 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1024,7 +1024,7 @@
coda_create(void *v)
{
/* true args */
- struct vop_create_args *ap = v;
+ struct vop_create_v2_args *ap = v;
vnode_t *dvp = ap->a_dvp;
struct cnode *dcp = VTOC(dvp);
struct vattr *va = ap->a_vap;
@@ -1096,11 +1096,6 @@
error));)
}
- /*
- * vnodeops(9) says that we must unlock the parent and lock the child.
- * XXX Should we lock the child first?
- */
- vput(dvp);
if (!error) {
#ifdef CODA_VERBOSE
if ((cnp->cn_flags & LOCKLEAF) == 0)
@@ -1357,7 +1352,7 @@
coda_mkdir(void *v)
{
/* true args */
- struct vop_mkdir_args *ap = v;
+ struct vop_mkdir_v2_args *ap = v;
vnode_t *dvp = ap->a_dvp;
struct cnode *dcp = VTOC(dvp);
struct componentname *cnp = ap->a_cnp;
@@ -1420,13 +1415,6 @@
CODADEBUG(CODA_MKDIR, myprintf(("%s error %d\n", __func__, error));)
}
- /*
- * Currently, all mkdirs explicitly vput their dvp's.
- * It also appears that we *must* lock the vpp, since
- * lockleaf isn't set, but someone down the road is going
- * to try to unlock the new directory.
- */
- vput(dvp);
if (!error) {
if ((error = vn_lock(*ap->a_vpp, LK_EXCLUSIVE))) {
panic("%s: couldn't lock child", __func__);
@@ -1507,7 +1495,7 @@
coda_symlink(void *v)
{
/* true args */
- struct vop_symlink_args *ap = v;
+ struct vop_symlink_v2_args *ap = v;
vnode_t *dvp = ap->a_dvp;
struct cnode *dcp = VTOC(dvp);
/* a_vpp is used in place below */
@@ -1581,9 +1569,6 @@
}
exit:
- /* unlock and deference parent */
- vput(dvp);
-
CODADEBUG(CODA_SYMLINK, myprintf(("in symlink result %d\n",error)); )
return(error);
}
diff -r 67fbdb6ed0f5 -r e0415585f1fb sys/fs/adosfs/advnops.c
--- a/sys/fs/adosfs/advnops.c Fri Jan 17 10:52:36 2014 +0000
+++ b/sys/fs/adosfs/advnops.c Fri Jan 17 10:55:01 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: advnops.c,v 1.41 2013/03/18 19:35:35 plunky Exp $ */
+/* $NetBSD: advnops.c,v 1.42 2014/01/17 10:55:01 hannken Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: advnops.c,v 1.41 2013/03/18 19:35:35 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: advnops.c,v 1.42 2014/01/17 10:55:01 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -421,7 +421,7 @@
int
adosfs_symlink(void *v)
{
- struct vop_symlink_args /* {
+ struct vop_symlink_v2_args /* {
struct vnode *a_dvp;
struct vnode **a_vpp;
struct componentname *a_cnp;
@@ -430,7 +430,6 @@
} */ *ap = v;
VOP_ABORTOP(ap->a_dvp, ap->a_cnp);
- vput(ap->a_dvp);
return (EROFS);
}
diff -r 67fbdb6ed0f5 -r e0415585f1fb sys/fs/cd9660/cd9660_vnops.c
--- a/sys/fs/cd9660/cd9660_vnops.c Fri Jan 17 10:52:36 2014 +0000
+++ b/sys/fs/cd9660/cd9660_vnops.c Fri Jan 17 10:55:01 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cd9660_vnops.c,v 1.45 2013/06/23 07:28:36 dholland Exp $ */
+/* $NetBSD: cd9660_vnops.c,v 1.46 2014/01/17 10:55:01 hannken Exp $ */
/*-
* Copyright (c) 1994
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cd9660_vnops.c,v 1.45 2013/06/23 07:28:36 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd9660_vnops.c,v 1.46 2014/01/17 10:55:01 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -678,7 +678,7 @@
int
cd9660_symlink(void *v)
{
- struct vop_symlink_args /* {
+ struct vop_symlink_v2_args /* {
struct vnode *a_dvp;
struct vnode **a_vpp;
struct componentname *a_cnp;
@@ -687,7 +687,6 @@
} */ *ap = v;
VOP_ABORTOP(ap->a_dvp, ap->a_cnp);
- vput(ap->a_dvp);
return (EROFS);
}
diff -r 67fbdb6ed0f5 -r e0415585f1fb sys/fs/filecorefs/filecore_vnops.c
--- a/sys/fs/filecorefs/filecore_vnops.c Fri Jan 17 10:52:36 2014 +0000
+++ b/sys/fs/filecorefs/filecore_vnops.c Fri Jan 17 10:55:01 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: filecore_vnops.c,v 1.39 2013/10/20 17:14:48 christos Exp $ */
+/* $NetBSD: filecore_vnops.c,v 1.40 2014/01/17 10:55:01 hannken Exp $ */
/*-
* Copyright (c) 1994 The Regents of the University of California.
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: filecore_vnops.c,v 1.39 2013/10/20 17:14:48 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: filecore_vnops.c,v 1.40 2014/01/17 10:55:01 hannken Exp $");
Home |
Main Index |
Thread Index |
Old Index