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