Blame SOURCES/fix-startup-race.patch

01552a
From 530db7a38000c0ee82ef833eec27ca05539da59e Mon Sep 17 00:00:00 2001
01552a
From: Ray Strode <rstrode@redhat.com>
01552a
Date: Wed, 5 Feb 2014 15:09:13 -0500
01552a
Subject: [PATCH 1/2] main: don't show splash from cancel_pending_delayed_show
01552a
01552a
It was a weird to show something in a function called "cancel..show"
01552a
01552a
Instead move the logic to the one caller that actually needed that
01552a
functionality (on_ask_for_password)
01552a
---
01552a
 src/main.c | 24 ++++++++++++++----------
01552a
 1 file changed, 14 insertions(+), 10 deletions(-)
01552a
01552a
diff --git a/src/main.c b/src/main.c
01552a
index e1cbcd9..64552b4 100644
01552a
--- a/src/main.c
01552a
+++ b/src/main.c
01552a
@@ -455,95 +455,99 @@ show_default_splash (state_t *state)
01552a
   if (state->boot_splash == NULL)
01552a
     {
01552a
       ply_trace ("Trying old scheme for default splash");
01552a
       state->boot_splash = show_theme (state, PLYMOUTH_THEME_PATH "default.plymouth");
01552a
     }
01552a
 
01552a
   if (state->boot_splash == NULL)
01552a
     {
01552a
       ply_trace ("Could not start default splash screen,"
01552a
                  "showing text splash screen");
01552a
       state->boot_splash = show_theme (state, PLYMOUTH_THEME_PATH "text/text.plymouth");
01552a
     }
01552a
 
01552a
   if (state->boot_splash == NULL)
01552a
     {
01552a
       ply_trace ("Could not start text splash screen,"
01552a
                  "showing built-in splash screen");
01552a
       state->boot_splash = show_theme (state, NULL);
01552a
     }
01552a
 
01552a
   if (state->boot_splash == NULL)
01552a
     {
01552a
       ply_error ("plymouthd: could not start boot splash: %m");
01552a
       return;
01552a
     }
01552a
 }
01552a
 
01552a
 static void
01552a
 cancel_pending_delayed_show (state_t *state)
01552a
 {
01552a
-  bool has_open_seats;
01552a
-
01552a
   if (isnan (state->splash_delay))
01552a
     return;
01552a
 
01552a
   ply_event_loop_stop_watching_for_timeout (state->loop,
01552a
                                             (ply_event_loop_timeout_handler_t)
01552a
                                             show_splash,
01552a
                                             state);
01552a
   state->splash_delay = NAN;
01552a
-  has_open_seats = ply_device_manager_has_open_seats (state->device_manager);
01552a
-
01552a
-  if (state->is_shown && has_open_seats)
01552a
-    {
01552a
-      ply_trace ("splash delay cancelled, showing splash immediately");
01552a
-      show_splash (state);
01552a
-    }
01552a
 }
01552a
 
01552a
 static void
01552a
 on_ask_for_password (state_t      *state,
01552a
                      const char   *prompt,
01552a
                      ply_trigger_t *answer)
01552a
 {
01552a
   ply_entry_trigger_t *entry_trigger;
01552a
 
01552a
   if (state->boot_splash == NULL)
01552a
     {
01552a
       /* Waiting to be shown, boot splash will
01552a
        * arrive shortly so just sit tight
01552a
        */
01552a
       if (state->is_shown)
01552a
         {
01552a
-          ply_trace ("splash still coming up, waiting a bit");
01552a
+          bool has_open_seats;
01552a
+
01552a
           cancel_pending_delayed_show (state);
01552a
+
01552a
+          has_open_seats = ply_device_manager_has_open_seats (state->device_manager);
01552a
+
01552a
+          if (has_open_seats)
01552a
+            {
01552a
+              ply_trace ("seats open now, showing splash immediately");
01552a
+              show_splash (state);
01552a
+            }
01552a
+          else
01552a
+            {
01552a
+              ply_trace ("splash still coming up, waiting a bit");
01552a
+            }
01552a
         }
01552a
       else
01552a
         {
01552a
           /* No splash, client will have to get password */
01552a
           ply_trace ("no splash loaded, replying immediately with no password");
01552a
           ply_trigger_pull (answer, NULL);
01552a
           return;
01552a
         }
01552a
     }
01552a
 
01552a
   entry_trigger = calloc (1, sizeof (ply_entry_trigger_t));
01552a
   entry_trigger->type = PLY_ENTRY_TRIGGER_TYPE_PASSWORD;
01552a
   entry_trigger->prompt = prompt;
01552a
   entry_trigger->trigger = answer;
01552a
   ply_trace ("queuing password request with boot splash");
01552a
   ply_list_append_data (state->entry_triggers, entry_trigger);
01552a
   update_display (state);
01552a
 }
01552a
 
01552a
 static void
01552a
 on_ask_question (state_t      *state,
01552a
                  const char   *prompt,
01552a
                  ply_trigger_t *answer)
01552a
 {
01552a
   ply_entry_trigger_t *entry_trigger;
01552a
 
01552a
   entry_trigger = calloc (1, sizeof (ply_entry_trigger_t));
01552a
   entry_trigger->type = PLY_ENTRY_TRIGGER_TYPE_QUESTION;
01552a
   entry_trigger->prompt = prompt;
01552a
   entry_trigger->trigger = answer;
01552a
-- 
01552a
1.8.3.1
01552a
01552a
01552a
From 09bbba9201456305ac609d5f6a4be96463adcfd2 Mon Sep 17 00:00:00 2001
01552a
From: Ray Strode <rstrode@redhat.com>
01552a
Date: Wed, 5 Feb 2014 15:12:17 -0500
01552a
Subject: [PATCH 2/2] main: cancel show_splash timeout on deactivate
01552a
01552a
This fixes a race/crash where plymouthd get deactivated
01552a
right before the show timer fires and it tries to
01552a
show itself after things have been torn down.
01552a
---
01552a
 src/main.c | 2 ++
01552a
 1 file changed, 2 insertions(+)
01552a
01552a
diff --git a/src/main.c b/src/main.c
01552a
index 64552b4..4a9d91f 100644
01552a
--- a/src/main.c
01552a
+++ b/src/main.c
01552a
@@ -1211,60 +1211,62 @@ on_boot_splash_idle (state_t *state)
01552a
     }
01552a
   else if (state->deactivate_trigger != NULL)
01552a
     {
01552a
       ply_trace ("deactivating splash");
01552a
       deactivate_splash (state);
01552a
     }
01552a
 }
01552a
 
01552a
 static void
01552a
 on_deactivate (state_t       *state,
01552a
                ply_trigger_t *deactivate_trigger)
01552a
 {
01552a
   if (state->is_inactive)
01552a
     {
01552a
       ply_trigger_pull (deactivate_trigger, NULL);
01552a
       return;
01552a
     }
01552a
 
01552a
   if (state->deactivate_trigger != NULL)
01552a
     {
01552a
       ply_trigger_add_handler (state->deactivate_trigger,
01552a
                                (ply_trigger_handler_t)
01552a
                                ply_trigger_pull,
01552a
                                deactivate_trigger);
01552a
       return;
01552a
     }
01552a
 
01552a
   state->deactivate_trigger = deactivate_trigger;
01552a
 
01552a
   ply_trace ("deactivating");
01552a
+  cancel_pending_delayed_show (state);
01552a
+
01552a
   ply_device_manager_deactivate_keyboards (state->device_manager);
01552a
 
01552a
   if (state->boot_splash != NULL)
01552a
     {
01552a
       ply_boot_splash_become_idle (state->boot_splash,
01552a
                                    (ply_boot_splash_on_idle_handler_t)
01552a
                                    on_boot_splash_idle,
01552a
                                    state);
01552a
     }
01552a
   else
01552a
     {
01552a
       ply_trace ("deactivating splash");
01552a
       deactivate_splash (state);
01552a
     }
01552a
 }
01552a
 
01552a
 static void
01552a
 on_reactivate (state_t *state)
01552a
 {
01552a
   if (!state->is_inactive)
01552a
     return;
01552a
 
01552a
   if (state->local_console_terminal != NULL)
01552a
     {
01552a
       ply_terminal_open (state->local_console_terminal);
01552a
       ply_terminal_watch_for_vt_changes (state->local_console_terminal);
01552a
       ply_terminal_set_unbuffered_input (state->local_console_terminal);
01552a
       ply_terminal_ignore_mode_changes (state->local_console_terminal, false);
01552a
     }
01552a
 
01552a
-- 
01552a
1.8.3.1
01552a