[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [master] Improve reboot modes in init.c and shutdown.c.

On 02/02/2010 03:48 PM, Ales Kozumplik wrote:
> Stop the kernel correctly on HALT (so that we dont see 'kernel panic, they
> killed init' on i386 and on s390 one gets easy access to manual IPL).
> Introduce a new reboot method that does allow us to see the backtrace and
> doesn't scroll the screen up with useless unmount info.
> ---
>  loader/init.c     |    8 +++---
>  loader/init.h     |    5 +++-
>  loader/shutdown.c |   57 +++++++++++++++++++++++++++++++++-------------------
>  3 files changed, 44 insertions(+), 26 deletions(-)

> +void shutDown(int doKill, reboot_action rebootAction)
> +{
> +    if (rebootAction == DELAYED_REBOOT) {
> +        performDelayedReboot();
> +    } else if (doKill) {
> +        performUnmounts();
> +        performTerminations();
> +        performReboot(rebootAction);
> +    }
> +    printf("you may safely reboot your system\n");
> +    exit(0);
> +    return;

Hm, in what cases do we get here? I suppose, if called with doKill==0
(for the DELAYED_REBOOT case only after the user also pressed CTRL+C or
CAD to switch over to REBOOT). Since no sync, unmount, or process
termination has happened, I'm not sure it is really safe to reboot the
system due to unflushed dirty buffers. The old code went into the
endless loop after having printed this sentence and finally kicked off
unmount, termination, and reboot unconditionally with doKill==1 after
the CAD.

I fear, that whenever users boot the install system with "nokill" on the
boot command line, then we might again get into killing init since we
now exit the init process.

+void shutDown(int doKill, reboot_action rebootAction)
+    if (rebootAction != DELAYED_REBOOT) {
+        performUnmounts();
+        performTerminations();
+        performReboot(rebootAction);
+    }
+    performDelayedReboot();

Maybe that is safer?
Plus probably a "return" or "exit(0)" to make the compiler happy.

Pressing CTRL+C or CAD afterwards will again put the user in the
performDelayedReboot by means of init.c:sigintHandler() because of
nokill. I guess that would be intended. After all it is safe. ;)

Or am I completely off track here?


Linux on System z Development

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]