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

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

 



+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?

Steffen


Hi,

You are right and I didn't consider the nokill option much. Your patch is completely disregarding doKill, but suppose we used this version instead:
void shutDown(int doKill, reboot_action rebootAction)
{
    if (rebootAction != DELAYED_REBOOT && doKill) {
        performUnmounts();
        performTerminations();
        performReboot(rebootAction);
    }
    performDelayedReboot();
}

Here's what happens with any rebootAction and doKill=0:
:: the program goes into the endless loop in performDelayedReboot()
:: user presses cad, sigint handler is triggered
:: it calls getKillPolicy() that tells it to call shutDown() with doKill=0 again
:: endless loop in performDelayedReboot() again

I agree that with 'nokill' we should always do DELAYED_REBOOT. What we need to make it work correctly though is a mechanism to remember that we called performDelayedReboot() already and are ready to do normal shutdown. There's no nice solution: having the signitHandler() called in the middle we can't pass this information around as a parameter. Maybe we can use a static variable:

void shutDown(int doKill, reboot_action rebootAction)
{
    static int reentered = 0;

    if (reentered) {
        performUnmounts();
        performTerminations();
        performReboot(rebootAction);
    }
    reentered = 1;
    if (rebootAction == DELAYED_REBOOT || !doKill) {
        performDelayedReboot();
    } else {
        performUnmounts();
        performTerminations();
        performReboot(rebootAction);
    }
    exit(0);
}

What do you think?

Ales

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux