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.
This commit is contained in:
parent
d8e7058159
commit
e8c85a50ae
@ -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); \
|
||||
|
Loading…
x
Reference in New Issue
Block a user