Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Now that v_usecount tracks valid references add som...



details:   https://anonhg.NetBSD.org/src/rev/35b134f2ba28
branches:  trunk
changeset: 350025:35b134f2ba28
user:      hannken <hannken%NetBSD.org@localhost>
date:      Mon Jan 02 10:36:58 2017 +0000

description:
Now that v_usecount tracks valid references add some "v_usecount == 1"
assertions.

diffstat:

 sys/kern/vfs_vnode.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r c1641ea1b584 -r 35b134f2ba28 sys/kern/vfs_vnode.c
--- a/sys/kern/vfs_vnode.c      Mon Jan 02 10:35:00 2017 +0000
+++ b/sys/kern/vfs_vnode.c      Mon Jan 02 10:36:58 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_vnode.c,v 1.67 2017/01/02 10:35:00 hannken Exp $   */
+/*     $NetBSD: vfs_vnode.c,v 1.68 2017/01/02 10:36:58 hannken Exp $   */
 
 /*-
  * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -156,7 +156,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.67 2017/01/02 10:35:00 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.68 2017/01/02 10:36:58 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -304,6 +304,10 @@
        if (node->vi_state != from)
                vnpanic(vp, "from is %s, expected %s at %s:%d\n",
                    vstate_name(node->vi_state), vstate_name(from), func, line);
+       if ((from == VS_BLOCKED || to == VS_BLOCKED) && vp->v_usecount != 1)
+               vnpanic(vp, "%s to %s with usecount %d at %s:%d",
+                   vstate_name(from), vstate_name(to), vp->v_usecount,
+                   func, line);
 
        node->vi_state = to;
        if (from == VS_LOADING)
@@ -877,6 +881,7 @@
        mutex_enter(vp->v_interlock);
        VSTATE_CHANGE(vp, VS_BLOCKED, VS_ACTIVE);
 
+       KASSERT(vp->v_usecount == 1);
        vcache_reclaim(vp);
        vrelel(vp, 0);
 



Home | Main Index | Thread Index | Old Index