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/79c4a42bc2c4
branches:  trunk
changeset: 326243:79c4a42bc2c4
user:      hannken <hannken%NetBSD.org@localhost>
date:      Thu Jan 23 10:13:55 2014 +0000

description:
Change vnode operations create, mknod, mkdir and symlink to return
the resulting vnode *vpp unlocked.

Discussed on tech-kern@

Welcome to 6.99.30

diffstat:

 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_replay.c |   4 +-
 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c  |  52 ++--------------
 lib/libp2k/p2k.c                                        |   3 +-
 share/man/man9/vnodeops.9                               |  12 +-
 sys/coda/coda_vnops.c                                   |  24 ++-----
 sys/fs/adosfs/advnops.c                                 |   6 +-
 sys/fs/cd9660/cd9660_vnops.c                            |   6 +-
 sys/fs/filecorefs/filecore_vnops.c                      |   6 +-
 sys/fs/msdosfs/msdosfs_lookup.c                         |  11 ++-
 sys/fs/msdosfs/msdosfs_vnops.c                          |   8 +-
 sys/fs/nilfs/nilfs_vnops.c                              |  12 +-
 sys/fs/puffs/puffs_node.c                               |   5 +-
 sys/fs/puffs/puffs_vnops.c                              |  12 +-
 sys/fs/smbfs/smbfs_vnops.c                              |  10 +-
 sys/fs/sysvbfs/sysvbfs_vnops.c                          |   7 +-
 sys/fs/tmpfs/tmpfs_subr.c                               |   7 +-
 sys/fs/tmpfs/tmpfs_vnops.c                              |  12 +-
 sys/fs/udf/udf_subr.c                                   |  16 +---
 sys/fs/udf/udf_vnops.c                                  |  12 +-
 sys/fs/union/union_subr.c                               |   5 +-
 sys/fs/union/union_vnops.c                              |  34 +++++++---
 sys/fs/v7fs/v7fs_vnops.c                                |  24 +++++-
 sys/kern/uipc_usrreq.c                                  |   5 +-
 sys/kern/vfs_syscalls.c                                 |  14 ++--
 sys/kern/vfs_vnops.c                                    |   5 +-
 sys/kern/vnode_if.c                                     |  38 ++++++------
 sys/miscfs/fdesc/fdesc_vnops.c                          |   6 +-
 sys/miscfs/genfs/layer_vnops.c                          |  17 ++--
 sys/miscfs/kernfs/kernfs_vnops.c                        |   6 +-
 sys/miscfs/procfs/procfs_vnops.c                        |   6 +-
 sys/nfs/nfs_serv.c                                      |  16 +++-
 sys/nfs/nfs_vnops.c                                     |  16 +++-
 sys/rump/include/rump/rumpvnode_if.h                    |   4 +-
 sys/rump/librump/rumpvfs/rumpfs.c                       |  21 ++++--
 sys/rump/librump/rumpvfs/rumpvnode_if.c                 |   6 +-
 sys/sys/param.h                                         |   4 +-
 sys/sys/vnode_if.h                                      |  12 +-
 sys/ufs/chfs/chfs_vnode.c                               |   3 +-
 sys/ufs/chfs/chfs_vnops.c                               |  32 +++++-----
 sys/ufs/ext2fs/ext2fs_vnops.c                           |  18 +++--
 sys/ufs/lfs/lfs_vnops.c                                 |  13 ++-
 sys/ufs/lfs/ulfs_vnops.c                                |  15 ++-
 sys/ufs/ufs/ufs_vnops.c                                 |  18 +++--
 43 files changed, 290 insertions(+), 273 deletions(-)

diffs (truncated from 2205 to 300 lines):

diff -r 2eaf54dd5a4a -r 79c4a42bc2c4 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_replay.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_replay.c   Thu Jan 23 10:11:55 2014 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_replay.c   Thu Jan 23 10:13:55 2014 +0000
@@ -531,10 +531,8 @@
        VOP_UNLOCK(ZTOV(dzp));
 
 out:
-       if (error == 0 && vp != NULL) {
-               VOP_UNLOCK(vp);
+       if (error == 0 && vp != NULL)
                VN_RELE(vp);
-       }
 
        VN_RELE(ZTOV(dzp));
 
diff -r 2eaf54dd5a4a -r 79c4a42bc2c4 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c    Thu Jan 23 10:11:55 2014 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c    Thu Jan 23 10:13:55 2014 +0000
@@ -4946,7 +4946,7 @@
 static int
 zfs_netbsd_create(void *v)
 {
-       struct vop_create_v2_args /* {
+       struct vop_create_v3_args /* {
                struct vnode *a_dvp;
                struct vnode **a_vpp;
                struct componentname *a_cnp;
@@ -4981,20 +4981,9 @@
        /* XXX !EXCL is wrong here...  */
        error = zfs_create(dvp, __UNCONST(cnp->cn_nameptr), vap, !EXCL, mode,
            vpp, cnp->cn_cred);
-       if (error) {
-               KASSERT(*vpp == NULL);
-               goto out;
-       }
-       KASSERT(*vpp != NULL);
-
-       /*
-        * Lock *vpp in conformance to the VOP_CREATE protocol.
-        */
-       vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY);
-
-out:
+
+       KASSERT((error == 0) == (*vpp != NULL));
        KASSERT(VOP_ISLOCKED(dvp) == LK_EXCLUSIVE);
-       KASSERT((*vpp == NULL) || (VOP_ISLOCKED(*vpp) == LK_EXCLUSIVE));
 
        return (error);
 }
@@ -5051,7 +5040,7 @@
 static int
 zfs_netbsd_mkdir(void *v)
 {
-       struct vop_mkdir_v2_args /* {
+       struct vop_mkdir_v3_args /* {
                struct vnode *a_dvp;
                struct vnode **a_vpp;
                struct componentname *a_cnp;
@@ -5083,20 +5072,9 @@
 
        error = zfs_mkdir(dvp, __UNCONST(cnp->cn_nameptr), vap, vpp,
            cnp->cn_cred, NULL, 0, NULL);
-       if (error) {
-               KASSERT(*vpp == NULL);
-               goto out;
-       }
-       KASSERT(*vpp != NULL);
-
-       /*
-        * Lock *vpp in conformance to the VOP_MKDIR protocol.
-        */
-       vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY);
-
-out:
+
+       KASSERT((error == 0) == (*vpp != NULL));
        KASSERT(VOP_ISLOCKED(dvp) == LK_EXCLUSIVE);
-       KASSERT((*vpp == NULL) || (VOP_ISLOCKED(*vpp) == LK_EXCLUSIVE));
 
        return (error);
 }
@@ -5361,7 +5339,7 @@
 static int
 zfs_netbsd_symlink(void *v)
 {
-       struct vop_symlink_v2_args /* {
+       struct vop_symlink_v3_args /* {
                struct vnode *a_dvp;
                struct vnode **a_vpp;
                struct componentname *a_cnp;
@@ -5397,21 +5375,9 @@
 
        error = zfs_symlink(dvp, vpp, __UNCONST(cnp->cn_nameptr), vap, target,
            cnp->cn_cred, 0);
-       if (error) {
-               KASSERT(*vpp == NULL);
-               goto out;
-       }
-       KASSERT(*vpp != NULL);
-
-
-       /*
-        * Lock *vpp in conformance to the VOP_SYMLINK protocol.
-        */
-       vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY);
-
-out:
+
+       KASSERT((error == 0) == (*vpp != NULL));
        KASSERT(VOP_ISLOCKED(dvp) == LK_EXCLUSIVE);
-       KASSERT((*vpp == NULL) || (VOP_ISLOCKED(*vpp) == LK_EXCLUSIVE));
 
        return (error);
 }
diff -r 2eaf54dd5a4a -r 79c4a42bc2c4 lib/libp2k/p2k.c
--- a/lib/libp2k/p2k.c  Thu Jan 23 10:11:55 2014 +0000
+++ b/lib/libp2k/p2k.c  Thu Jan 23 10:13:55 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: p2k.c,v 1.61 2014/01/17 10:55:01 hannken Exp $ */
+/*     $NetBSD: p2k.c,v 1.62 2014/01/23 10:13:55 hannken Exp $ */
 
 /*
  * Copyright (c) 2007, 2008, 2009  Antti Kantee.  All Rights Reserved.
@@ -808,7 +808,6 @@
        freecn(cn);
 
        if (rv == 0) {
-               RUMP_VOP_UNLOCK(vp);
                p2n = getp2n(p2m, vp, true, p2n);
                puffs_newinfo_setcookie(pni, p2n);
        } else {
diff -r 2eaf54dd5a4a -r 79c4a42bc2c4 share/man/man9/vnodeops.9
--- a/share/man/man9/vnodeops.9 Thu Jan 23 10:11:55 2014 +0000
+++ b/share/man/man9/vnodeops.9 Thu Jan 23 10:13:55 2014 +0000
@@ -1,4 +1,4 @@
-.\"     $NetBSD: vnodeops.9,v 1.90 2014/01/17 10:55:01 hannken Exp $
+.\"     $NetBSD: vnodeops.9,v 1.91 2014/01/23 10:13:56 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 January 17, 2014
+.Dd January 23, 2014
 .Dt VNODEOPS 9
 .Os
 .Sh NAME
@@ -429,7 +429,7 @@
 .Fa vap
 specifies the attributes that the new file should be created with.
 If the file is successfully created, the address of the resulting
-locked vnode is returned in
+unlocked vnode is returned in
 .Fa vpp
 and zero is returned.
 .Pp
@@ -461,7 +461,7 @@
 specifies the attributes that the new device-special file should be
 created with.
 If the file is successfully created, the address of the resulting
-locked vnode is returned in
+unlocked vnode is returned in
 .Fa vpp
 and zero is returned.
 .Pp
@@ -875,7 +875,7 @@
 specifies the attributes that the new directory should be created
 with.
 If the file is successfully created, the address of the resulting
-locked vnode is returned in
+unlocked vnode is returned in
 .Fa vpp
 and zero is returned.
 .Pp
@@ -925,7 +925,7 @@
 .Fa target
 specifies the pathname of the target of the symbolic link.
 If the symbolic link is successfully created, the address of the
-resulting locked vnode is returned in
+resulting unlocked vnode is returned in
 .Fa vpp
 and zero is returned.
 .Pp
diff -r 2eaf54dd5a4a -r 79c4a42bc2c4 sys/coda/coda_vnops.c
--- a/sys/coda/coda_vnops.c     Thu Jan 23 10:11:55 2014 +0000
+++ b/sys/coda/coda_vnops.c     Thu Jan 23 10:13:55 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: coda_vnops.c,v 1.92 2014/01/17 10:55:01 hannken Exp $  */
+/*     $NetBSD: coda_vnops.c,v 1.93 2014/01/23 10:13:56 hannken Exp $  */
 
 /*
  *
@@ -46,7 +46,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.92 2014/01/17 10:55:01 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.93 2014/01/23 10:13:56 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1024,7 +1024,7 @@
 coda_create(void *v)
 {
 /* true args */
-    struct vop_create_v2_args *ap = v;
+    struct vop_create_v3_args *ap = v;
     vnode_t *dvp = ap->a_dvp;
     struct cnode *dcp = VTOC(dvp);
     struct vattr *va = ap->a_vap;
@@ -1101,10 +1101,6 @@
        if ((cnp->cn_flags & LOCKLEAF) == 0)
            /* This should not happen; flags are for lookup only. */
            printf("%s: LOCKLEAF not set!\n", __func__);
-
-       if ((error = vn_lock(*ap->a_vpp, LK_EXCLUSIVE)))
-           /* XXX Perhaps avoid this panic. */
-           panic("%s: couldn't lock child", __func__);
 #endif
     }
 
@@ -1352,7 +1348,7 @@
 coda_mkdir(void *v)
 {
 /* true args */
-    struct vop_mkdir_v2_args *ap = v;
+    struct vop_mkdir_v3_args *ap = v;
     vnode_t *dvp = ap->a_dvp;
     struct cnode *dcp = VTOC(dvp);
     struct componentname  *cnp = ap->a_cnp;
@@ -1415,12 +1411,6 @@
        CODADEBUG(CODA_MKDIR, myprintf(("%s error %d\n", __func__, error));)
     }
 
-    if (!error) {
-       if ((error = vn_lock(*ap->a_vpp, LK_EXCLUSIVE))) {
-           panic("%s: couldn't lock child", __func__);
-       }
-    }
-
     return(error);
 }
 
@@ -1495,7 +1485,7 @@
 coda_symlink(void *v)
 {
 /* true args */
-    struct vop_symlink_v2_args *ap = v;
+    struct vop_symlink_v3_args *ap = v;
     vnode_t *dvp = ap->a_dvp;
     struct cnode *dcp = VTOC(dvp);
     /* a_vpp is used in place below */
@@ -1564,8 +1554,10 @@
        cnp->cn_flags &= ~(MODMASK | OPMASK);
        cnp->cn_flags |= LOOKUP;
        error = VOP_LOOKUP(dvp, ap->a_vpp, cnp);
+       /* XXX unlock node until lookup returns unlocked nodes. */
+       if (error == 0)
+               VOP_UNLOCK(*ap->a_vpp);
        cnp->cn_flags = saved_cn_flags;
-       /* Either an error occurs, or ap->a_vpp is locked. */
     }
 
  exit:
diff -r 2eaf54dd5a4a -r 79c4a42bc2c4 sys/fs/adosfs/advnops.c
--- a/sys/fs/adosfs/advnops.c   Thu Jan 23 10:11:55 2014 +0000
+++ b/sys/fs/adosfs/advnops.c   Thu Jan 23 10:13:55 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: advnops.c,v 1.42 2014/01/17 10:55:01 hannken Exp $     */
+/*     $NetBSD: advnops.c,v 1.43 2014/01/23 10:13:56 hannken Exp $     */
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: advnops.c,v 1.42 2014/01/17 10:55:01 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: advnops.c,v 1.43 2014/01/23 10:13:56 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -421,7 +421,7 @@
 int
 adosfs_symlink(void *v)
 {
-       struct vop_symlink_v2_args /* {
+       struct vop_symlink_v3_args /* {
                struct vnode *a_dvp;
                struct vnode **a_vpp;
                struct componentname *a_cnp;
diff -r 2eaf54dd5a4a -r 79c4a42bc2c4 sys/fs/cd9660/cd9660_vnops.c
--- a/sys/fs/cd9660/cd9660_vnops.c      Thu Jan 23 10:11:55 2014 +0000
+++ b/sys/fs/cd9660/cd9660_vnops.c      Thu Jan 23 10:13:55 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cd9660_vnops.c,v 1.46 2014/01/17 10:55:01 hannken Exp $        */
+/*     $NetBSD: cd9660_vnops.c,v 1.47 2014/01/23 10:13:56 hannken Exp $        */



Home | Main Index | Thread Index | Old Index