Unloading md module causes a panic
the following sequence of commands easily make my box (running HEAD) panic:
# kldload md
# kldunload md
Backtrace and dump available.
#5 Updated by nthery almost 6 years ago
2009/1/22 Antonio Huete Jimenez (via DragonFly issue tracker)
> Antonio Huete Jimenez <email@example.com> added the comment:
> Still happening on 2.0.1
> See attached image.
I can reproduce it if and only if md is already compiled in the kernel.
What happens is that when kldloading md, the kernel tries to register
the debug.mddebug sysctl a second time (as md is already in the
kernel). It complains (the "can't re-use a leaf" msg) and stops the
registration but carries on loading the module.
When kldunloading, the kernel tries to unregister the module instance
of debug.mddebug and panics because it was not registered in the first
Is there a way to detect during kldload that the module is already
part of the kernel?
I propose to close this bug as it is caused by incorrect user manipulation.
#8 Updated by tuxillo almost 5 years ago
I think what is happening here is , despite md is already included in the
kernel, the module is not registered and thus modlist_lookup2() doesn't find it,
so kldload() syscall succeeds instead of failing in EEXIST as it should be.
I'm going to try to provide a patch to fix this based on some recommendatiosn
given by Alex.