Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Move the diagnostic check for a missing VOP_CLOSE()...



details:   https://anonhg.NetBSD.org/src/rev/5b995fe869d8
branches:  trunk
changeset: 772148:5b995fe869d8
user:      hannken <hannken%NetBSD.org@localhost>
date:      Tue Dec 20 16:49:37 2011 +0000

description:
Move the diagnostic check for a missing VOP_CLOSE() to the top of vrelel().
As long as we hold the vnode interlock there is no chance for this vnode
to gain new references.

Fixes false alarms observed by Thor Lancelot Simon and reported on tech-kern.

Ok: David Holland <dholland%netbsd.org@localhost>

diffstat:

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

diffs (46 lines):

diff -r b5813223ae4c -r 5b995fe869d8 sys/kern/vfs_vnode.c
--- a/sys/kern/vfs_vnode.c      Tue Dec 20 16:43:14 2011 +0000
+++ b/sys/kern/vfs_vnode.c      Tue Dec 20 16:49:37 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_vnode.c,v 1.14 2011/10/07 09:35:06 hannken Exp $   */
+/*     $NetBSD: vfs_vnode.c,v 1.15 2011/12/20 16:49:37 hannken Exp $   */
 
 /*-
  * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -120,7 +120,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.14 2011/10/07 09:35:06 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.15 2011/12/20 16:49:37 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -637,6 +637,13 @@
 
        KASSERT((vp->v_iflag & VI_XLOCK) == 0);
 
+#ifdef DIAGNOSTIC
+       if ((vp->v_type == VBLK || vp->v_type == VCHR) &&
+           vp->v_specnode != NULL && vp->v_specnode->sn_opencnt != 0) {
+               vprint("vrelel: missing VOP_CLOSE()", vp);
+       }
+#endif
+
        /*
         * If not clean, deactivate the vnode, but preserve
         * our reference across the call to VOP_INACTIVE().
@@ -706,13 +713,6 @@
                        return;
                }
 
-#ifdef DIAGNOSTIC
-               if ((vp->v_type == VBLK || vp->v_type == VCHR) &&
-                   vp->v_specnode != NULL && vp->v_specnode->sn_opencnt != 0) {
-                       vprint("vrelel: missing VOP_CLOSE()", vp);
-               }
-#endif
-
                /*
                 * The vnode can gain another reference while being
                 * deactivated.  If VOP_INACTIVE() indicates that



Home | Main Index | Thread Index | Old Index