Blame SOURCES/rh1084554-balance-queued-state-lock.patch

94180d
From fc1351504db557b942c121b480fca661162702f7 Mon Sep 17 00:00:00 2001
94180d
From: Thomas Haller <thaller@redhat.com>
94180d
Date: Fri, 4 Apr 2014 14:55:37 +0200
94180d
Subject: [PATCH] core: fix hanging pending_action "queued state lock"
94180d
94180d
This bug caused nm-online to hang because "startup complete" state
94180d
is never reached. Sometimes you also see this error in the logfile:
94180d
94180d
  <warn> (em1): add_pending_action (3): 'queued state lock' already added
94180d
  file devices/nm-device.c: line 7178 (nm_device_add_pending_action): should not be reached
94180d
94180d
https://bugzilla.redhat.com/show_bug.cgi?id=1084554
94180d
https://bugzilla.redhat.com/show_bug.cgi?id=1084556
94180d
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1082045
94180d
94180d
Signed-off-by: Thomas Haller <thaller@redhat.com>
94180d
---
94180d
 src/devices/nm-device.c | 22 +++++++++-------------
94180d
 1 file changed, 9 insertions(+), 13 deletions(-)
94180d
94180d
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
94180d
index 6f33366..817b924 100644
94180d
--- a/src/devices/nm-device.c
94180d
+++ b/src/devices/nm-device.c
94180d
@@ -6840,37 +6840,33 @@ nm_device_queue_state (NMDevice *self,
94180d
 {
94180d
 	NMDevicePrivate *priv;
94180d
 
94180d
 	g_return_if_fail (NM_IS_DEVICE (self));
94180d
 
94180d
 	priv = NM_DEVICE_GET_PRIVATE (self);
94180d
 
94180d
-	/* "lock" the pending actions so that if there was a previously
94180d
-	 * queued action that's about to be cleared, that doesn't drop
94180d
-	 * the pending actions to 0 before we add the new pending action.
94180d
-	 */
94180d
-	nm_device_add_pending_action (self, "queued state lock");
94180d
+	if (priv->queued_state.id && priv->queued_state.state == state)
94180d
+		return;
94180d
+
94180d
+	/* Add pending action for the new state before clearing the queued states, so
94180d
+	 * that we don't accidently pop all pending states and reach 'startup complete'  */
94180d
+	nm_device_add_pending_action (self, queued_state_to_string (state));
94180d
 
94180d
 	/* We should only ever have one delayed state transition at a time */
94180d
 	if (priv->queued_state.id) {
94180d
-		if (priv->queued_state.state == state)
94180d
-			return;
94180d
 		nm_log_warn (LOGD_DEVICE, "(%s): overwriting previously queued state change to %s (%s)",
94180d
-					 nm_device_get_iface (self),
94180d
-					 state_to_string (priv->queued_state.state),
94180d
-					 reason_to_string (priv->queued_state.reason));
94180d
+		             nm_device_get_iface (self),
94180d
+		             state_to_string (priv->queued_state.state),
94180d
+		             reason_to_string (priv->queued_state.reason));
94180d
 		nm_device_queued_state_clear (self);
94180d
 	}
94180d
 
94180d
 	priv->queued_state.state = state;
94180d
 	priv->queued_state.reason = reason;
94180d
 	priv->queued_state.id = g_idle_add (queued_set_state, self);
94180d
-	nm_device_add_pending_action (self, queued_state_to_string (state));
94180d
-
94180d
-	nm_device_remove_pending_action (self, "queued state lock");
94180d
 
94180d
 	nm_log_dbg (LOGD_DEVICE, "(%s): queued state change to %s due to %s (id %d)",
94180d
 	            nm_device_get_iface (self), state_to_string (state), reason_to_string (reason),
94180d
 	            priv->queued_state.id);
94180d
 }
94180d
 
94180d
 NMDeviceState
94180d
-- 
94180d
1.9.0
94180d