aboutsummaryrefslogtreecommitdiff
path: root/sys/geom/geom_subr.c
diff options
context:
space:
mode:
authorJaakko Heinonen <jh@FreeBSD.org>2010-04-19 20:07:35 +0000
committerJaakko Heinonen <jh@FreeBSD.org>2010-04-19 20:07:35 +0000
commit002d1d1c385f0c9316948f2ed64973fbf496e270 (patch)
tree67c8a1624fabdf4effa99e512030ed83f1b2cc26 /sys/geom/geom_subr.c
parent4ad53b2511c4a4421c361c2fe6622e4865d4695e (diff)
downloadsrc-002d1d1c385f0c9316948f2ed64973fbf496e270.tar.gz
src-002d1d1c385f0c9316948f2ed64973fbf496e270.zip
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
Notes
Notes: svn path=/head/; revision=206859
Diffstat (limited to 'sys/geom/geom_subr.c')
-rw-r--r--sys/geom/geom_subr.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/sys/geom/geom_subr.c b/sys/geom/geom_subr.c
index 9bef0e3638ff..772277e02a7b 100644
--- a/sys/geom/geom_subr.c
+++ b/sys/geom/geom_subr.c
@@ -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_consumer *cp, void *var, int len)
#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)