summaryrefslogtreecommitdiffstats
path: root/sys/geom
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2006-07-12 15:44:00 +0000
committerpjd <pjd@FreeBSD.org>2006-07-12 15:44:00 +0000
commitc146aa7e54f09927bbbd2be13251f17ebdbbd8ee (patch)
tree1b95b9d29be366128d4ac57b2b0e60daef0e6d52 /sys/geom
parent07ad858feec96a88c5137685ef6bd05081c7fcbd (diff)
downloadFreeBSD-src-c146aa7e54f09927bbbd2be13251f17ebdbbd8ee.zip
FreeBSD-src-c146aa7e54f09927bbbd2be13251f17ebdbbd8ee.tar.gz
Only check if we're freeing a valid object if we hold the topology lock.
This prevents panic under heavy load with DIAGNOSTIC compiled in.
Diffstat (limited to 'sys/geom')
-rw-r--r--sys/geom/geom.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/geom/geom.h b/sys/geom/geom.h
index c3863c5..715d9c7 100644
--- a/sys/geom/geom.h
+++ b/sys/geom/geom.h
@@ -277,6 +277,8 @@ void g_print_bio(struct bio *bp);
#ifdef _KERNEL
+extern struct sx topology_lock;
+
struct g_kerneldump {
off_t offset;
off_t length;
@@ -298,14 +300,15 @@ g_free(void *ptr)
{
#ifdef DIAGNOSTIC
- KASSERT(g_valid_obj(ptr) == 0,
- ("g_free(%p) of live object, type %d", ptr, g_valid_obj(ptr)));
+ if (sx_xlocked(&topology_lock)) {
+ KASSERT(g_valid_obj(ptr) == 0,
+ ("g_free(%p) of live object, type %d", ptr,
+ g_valid_obj(ptr)));
+ }
#endif
free(ptr, M_GEOM);
}
-extern struct sx topology_lock;
-
#define g_topology_lock() \
do { \
mtx_assert(&Giant, MA_NOTOWNED); \
OpenPOWER on IntegriCloud