summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_module.c
diff options
context:
space:
mode:
authortruckman <truckman@FreeBSD.org>2004-08-20 21:47:48 +0000
committertruckman <truckman@FreeBSD.org>2004-08-20 21:47:48 +0000
commitf36627bd561bb62f96a7f00ee78fa6c29da2f021 (patch)
treefba4b3ebc7e90cb82ea165360bddefe85c69c6da /sys/kern/kern_module.c
parent54d23a34f60fa406f7b0eebdfec259936c967881 (diff)
downloadFreeBSD-src-f36627bd561bb62f96a7f00ee78fa6c29da2f021.zip
FreeBSD-src-f36627bd561bb62f96a7f00ee78fa6c29da2f021.tar.gz
Don't bother calling the module event handlers from module_shutdown()
in the shutdown_final state if the RB_NOSYNC flag is set. The specific motivation in this case is that a system panic in an interrupt context results in a call to module_shutdown(), which calls g_modevent(), which calls g_malloc(..., M_WAITOK), which results in a second panic. While g_modevent() could be fixed to not call malloc() for MOD_SHUTDOWN events (which it doesn't handle in any case), it is probably also a good idea to entirely skip the execution of the module shutdown handlers after a panic. This may be a MFC candidate for RELENG_5.
Diffstat (limited to 'sys/kern/kern_module.c')
-rw-r--r--sys/kern/kern_module.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/kern/kern_module.c b/sys/kern/kern_module.c
index 9dfe3ba..cecb2e1 100644
--- a/sys/kern/kern_module.c
+++ b/sys/kern/kern_module.c
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
#include <sys/proc.h>
#include <sys/lock.h>
#include <sys/mutex.h>
+#include <sys/reboot.h>
#include <sys/sx.h>
#include <sys/module.h>
#include <sys/linker.h>
@@ -94,6 +95,8 @@ module_shutdown(void *arg1, int arg2)
{
module_t mod;
+ if (arg2 & RB_NOSYNC)
+ return;
MOD_SLOCK;
TAILQ_FOREACH(mod, &modules, link)
MOD_EVENT(mod, MOD_SHUTDOWN);
OpenPOWER on IntegriCloud