Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Apr 2010 20:07:35 +0000 (UTC)
From:      Jaakko Heinonen <jh@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r206859 - head/sys/geom
Message-ID:  <201004192007.o3JK7Zsc002566@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jh
Date: Mon Apr 19 20:07:35 2010
New Revision: 206859
URL: http://svn.freebsd.org/changeset/base/206859

Log:
  Fix ddb(4) "show geom addr" command when INVARIANTS is enabled. Don't
  assert that the topology lock is held when g_valid_obj() is called from
  debugger.
  
  MFC after:	1 week

Modified:
  head/sys/geom/geom_subr.c

Modified: head/sys/geom/geom_subr.c
==============================================================================
--- head/sys/geom/geom_subr.c	Mon Apr 19 19:50:39 2010	(r206858)
+++ head/sys/geom/geom_subr.c	Mon Apr 19 20:07:35 2010	(r206859)
@@ -59,6 +59,10 @@ __FBSDID("$FreeBSD$");
 #include <ddb/ddb.h>
 #endif
 
+#ifdef KDB
+#include <sys/kdb.h>
+#endif
+
 struct class_list_head g_classes = LIST_HEAD_INITIALIZER(g_classes);
 static struct g_tailq_head geoms = TAILQ_HEAD_INITIALIZER(geoms);
 char *g_wait_event, *g_wait_up, *g_wait_down, *g_wait_sim;
@@ -1011,12 +1015,11 @@ g_getattr__(const char *attr, struct g_c
 
 #if defined(DIAGNOSTIC) || defined(DDB)
 /*
- * This function walks (topologically unsafely) the mesh and return a
- * non-zero integer if it finds the argument pointer is an object.
- * The return value indicates which type of object it is belived to be.
- * If topology is not locked, this function is potentially dangerous,
- * but since it is for debugging purposes and can be useful for instance
- * from DDB, we do not assert topology lock is held.
+ * This function walks the mesh and returns a non-zero integer if it
+ * finds the argument pointer is an object. The return value indicates
+ * which type of object it is believed to be. If topology is not locked,
+ * this function is potentially dangerous, but we don't assert that the
+ * topology lock is held when called from debugger.
  */
 int
 g_valid_obj(void const *ptr)
@@ -1026,7 +1029,10 @@ g_valid_obj(void const *ptr)
 	struct g_consumer *cp;
 	struct g_provider *pp;
 
-	g_topology_assert();
+#ifdef KDB
+	if (kdb_active == 0)
+#endif
+		g_topology_assert();
 
 	LIST_FOREACH(mp, &g_classes, class) {
 		if (ptr == mp)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201004192007.o3JK7Zsc002566>