summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_shutdown.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2001-10-19 23:32:03 +0000
committerpeter <peter@FreeBSD.org>2001-10-19 23:32:03 +0000
commitf36c042920ca6b5312b59dcfe76dc7237b96d767 (patch)
tree217b1137d89adf203a8d8908c3344dede6524623 /sys/kern/kern_shutdown.c
parentb83678939d020372ddd43b08bdfd1e1bf67e6e02 (diff)
downloadFreeBSD-src-f36c042920ca6b5312b59dcfe76dc7237b96d767.zip
FreeBSD-src-f36c042920ca6b5312b59dcfe76dc7237b96d767.tar.gz
Add a sysctl for preventing the sync() in panic() recovery. This can
be so dangerous it isn't funny. eg: if you panic inside NFS or softdep, and then try and sync you run into held locks and cause either deadlocks, recursive panics or other interesting chaos. Default is unchanged.
Diffstat (limited to 'sys/kern/kern_shutdown.c')
-rw-r--r--sys/kern/kern_shutdown.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c
index d493599..4686134 100644
--- a/sys/kern/kern_shutdown.c
+++ b/sys/kern/kern_shutdown.c
@@ -91,6 +91,10 @@ SYSCTL_INT(_debug, OID_AUTO, debugger_on_panic, CTLFLAG_RW,
&debugger_on_panic, 0, "Run debugger on kernel panic");
#endif
+int sync_on_panic = 1;
+SYSCTL_INT(_kern, OID_AUTO, sync_on_panic, CTLFLAG_RW,
+ &sync_on_panic, 0, "Do a sync before rebooting from a panic");
+
SYSCTL_NODE(_kern, OID_AUTO, shutdown, CTLFLAG_RW, 0, "Shutdown environment");
#ifdef HW_WDOG
@@ -625,6 +629,8 @@ panic(const char *fmt, ...)
}
#endif
#endif
+ if (!sync_on_panic)
+ bootopt |= RB_NOSYNC;
boot(bootopt);
}
OpenPOWER on IntegriCloud