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
This commit is contained in:
Warner Losh 2018-03-22 15:11:53 +00:00
parent ad5c8bd63a
commit e7932420b0

View File

@ -3858,28 +3858,22 @@ scgetc(sc_softc_t *sc, u_int flags, struct sc_cnstate *sp)
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;