diff options
-rw-r--r-- | sys/geom/geom.h | 11 |
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); \ |