Module Name:    src
Committed By:   hannken
Date:           Tue Dec 20 16:49:37 UTC 2011

Modified Files:
        src/sys/kern: vfs_vnode.c

Log Message:
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 <dholl...@netbsd.org>


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/kern/vfs_vnode.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/vfs_vnode.c
diff -u src/sys/kern/vfs_vnode.c:1.14 src/sys/kern/vfs_vnode.c:1.15
--- src/sys/kern/vfs_vnode.c:1.14	Fri Oct  7 09:35:06 2011
+++ src/sys/kern/vfs_vnode.c	Tue Dec 20 16:49:37 2011
@@ -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 @@ vrelel(vnode_t *vp, int flags)
 
 	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 @@ retry:
 			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

Reply via email to