Blame SOURCES/fix-startup-race.patch

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