Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Must always lock the parent -> lock the child -> un...



details:   https://anonhg.NetBSD.org/src/rev/970efc7fa85b
branches:  trunk
changeset: 822099:970efc7fa85b
user:      hannken <hannken%NetBSD.org@localhost>
date:      Wed Mar 01 10:43:37 2017 +0000

description:
Must always lock the parent -> lock the child -> unlock the parent.

diffstat:

 sys/kern/vfs_vnops.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (35 lines):

diff -r 976f84993a02 -r 970efc7fa85b sys/kern/vfs_vnops.c
--- a/sys/kern/vfs_vnops.c      Wed Mar 01 10:41:28 2017 +0000
+++ b/sys/kern/vfs_vnops.c      Wed Mar 01 10:43:37 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_vnops.c,v 1.193 2015/02/04 07:09:37 msaitoh Exp $  */
+/*     $NetBSD: vfs_vnops.c,v 1.194 2017/03/01 10:43:37 hannken Exp $  */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.193 2015/02/04 07:09:37 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.194 2017/03/01 10:43:37 hannken Exp $");
 
 #include "veriexec.h"
 
@@ -210,12 +210,14 @@
                                 va.va_vaflags |= VA_EXCLUSIVE;
                        error = VOP_CREATE(ndp->ni_dvp, &ndp->ni_vp,
                                           &ndp->ni_cnd, &va);
-                       vput(ndp->ni_dvp);
-                       if (error)
+                       if (error) {
+                               vput(ndp->ni_dvp);
                                goto out;
+                       }
                        fmode &= ~O_TRUNC;
                        vp = ndp->ni_vp;
                        vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+                       vput(ndp->ni_dvp);
                } else {
                        VOP_ABORTOP(ndp->ni_dvp, &ndp->ni_cnd);
                        if (ndp->ni_dvp == ndp->ni_vp)



Home | Main Index | Thread Index | Old Index