Blame SOURCES/0029-rh1269199-assume-external-device-race-2.patch

ab7d06
From c60b87314500aae0b855870c394662962905de80 Mon Sep 17 00:00:00 2001
ab7d06
From: Thomas Haller <thaller@redhat.com>
ab7d06
Date: Fri, 9 Oct 2015 21:45:23 +0200
ab7d06
Subject: [PATCH 1/1] device: fix wrongly managing external-down device due to
ab7d06
 not setting EXTERNAL_DOWN
ab7d06
ab7d06
The unmanaged-flag NM_UNMANAGED_EXTERNAL_DOWN is initially set during
ab7d06
nm_device_finish_init(). But it was only set if the device was down at
ab7d06
that point.
ab7d06
ab7d06
If due to a race the platform device was not yet initialized, a later
ab7d06
initialization in device_link_changed() would clear NM_UNMANAGED_PLATFORM_INIT.
ab7d06
If the device is not external-down (because it was already up during
ab7d06
nm_device_finish_init()), the device will be managed right away with
ab7d06
reason NM_DEVICE_STATE_REASON_NOW_MANAGED.
ab7d06
ab7d06
Together with commit e29ab54335c6a5ef1ce6bac525f1f18a8e81b96e, this
ab7d06
is a race that causes a failure to assume the external-down device.
ab7d06
ab7d06
https://bugzilla.redhat.com/show_bug.cgi?id=1269199
ab7d06
(cherry picked from commit 120847c8a37cdba9116d26891c8dc725ad8d9100)
ab7d06
(cherry picked from commit a77a3aa7ddc79695d6b30960826306ab98068e1c)
ab7d06
---
ab7d06
 src/devices/nm-device.c | 5 +++--
ab7d06
 1 file changed, 3 insertions(+), 2 deletions(-)
ab7d06
ab7d06
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
ab7d06
index 7c49f3f..5e413ba 100644
ab7d06
--- a/src/devices/nm-device.c
ab7d06
+++ b/src/devices/nm-device.c
ab7d06
@@ -1144,8 +1144,9 @@ nm_device_finish_init (NMDevice *self)
ab7d06
 
ab7d06
 	/* Do not manage externally created software devices until they are IFF_UP */
ab7d06
 	if (   NM_DEVICE_GET_CLASS (self)->can_unmanaged_external_down (self)
ab7d06
-	    && !nm_platform_link_is_up (NM_PLATFORM_GET, priv->ifindex)
ab7d06
-	    && priv->ifindex > 0)
ab7d06
+	    && priv->ifindex > 0
ab7d06
+	    && (   !priv->up
ab7d06
+	        || !priv->platform_link_initialized))
ab7d06
 		nm_device_set_initial_unmanaged_flag (self, NM_UNMANAGED_EXTERNAL_DOWN, TRUE);
ab7d06
 
ab7d06
 	if (priv->master)
ab7d06
-- 
ab7d06
2.4.3
ab7d06