aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/syscons
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2018-03-22 15:11:53 +0000
committerWarner Losh <imp@FreeBSD.org>2018-03-22 15:11:53 +0000
commite7932420b000ab045e8dd1bda25c894055a14679 (patch)
tree1f3d869fc46337733da9e22b2cd3f9f0d83fb638 /sys/dev/syscons
parentad5c8bd63ad4d1afc3238adbefd94253b9111da9 (diff)
downloadsrc-e7932420b000ab045e8dd1bda25c894055a14679.tar.gz
src-e7932420b000ab045e8dd1bda25c894055a14679.zip
Revert r331298
Normally, shutdown_nice() just signals init. However, sometimes it calls kern_reboot directly. For that case, r331298 dropped the Giant lock before calling it. This turns out to be incorrect for the more common case where init exists and we just signal it. Restore the old behavior. The direct call to kern_reboot() doesn't sync buffers to the disk, so should work with Giant held, so we don't need to drop locks here for that. Noticed by: bde@ Sponsored by: Netflix
Notes
Notes: svn path=/head/; revision=331359
Diffstat (limited to 'sys/dev/syscons')
-rw-r--r--sys/dev/syscons/syscons.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c
index c5eed2309c9f..2020436d89bf 100644
--- a/sys/dev/syscons/syscons.c
+++ b/sys/dev/syscons/syscons.c
@@ -3858,28 +3858,22 @@ next_code:
case RBT:
#ifndef SC_DISABLE_REBOOT
- if (enable_reboot && !(flags & SCGETC_CN)) {
- mtx_unlock(&Giant);
+ if (enable_reboot && !(flags & SCGETC_CN))
shutdown_nice(0);
- }
#endif
break;
case HALT:
#ifndef SC_DISABLE_REBOOT
- if (enable_reboot && !(flags & SCGETC_CN)) {
- mtx_unlock(&Giant);
+ if (enable_reboot && !(flags & SCGETC_CN))
shutdown_nice(RB_HALT);
- }
#endif
break;
case PDWN:
#ifndef SC_DISABLE_REBOOT
- if (enable_reboot && !(flags & SCGETC_CN)) {
- mtx_unlock(&Giant);
+ if (enable_reboot && !(flags & SCGETC_CN))
shutdown_nice(RB_HALT|RB_POWEROFF);
- }
#endif
break;