From f583aec8066cefabf2f53b99ea55f3650f785b93 Mon Sep 17 00:00:00 2001 From: Antonio Cardace Date: Fri, 17 Jan 2020 15:14:53 +0100 Subject: nm-device: add new pending action to keep the device busy when in between states Add a 'in-state-change' pending action to be sure the device always has a pending when transitioning between states (this prevents callbacks to mark startup as complete while running _set_state_full()). This is needed as during the 'failed'->'disconnected' the pending action 'activation-*' for the device is removed resulting in an empty pending_actions list which then triggers 'check_if_startup_complete()' that will find no pending action and mark startup as complete even if the device could have been activated with another connection. https://bugzilla.redhat.com/show_bug.cgi?id=1759956 --- src/devices/nm-device.c | 9 +++++++++ src/devices/nm-device.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index e995bcac0d..9d70bb54f5 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -15541,6 +15541,12 @@ _set_state_full (NMDevice *self, reason_to_string_a (reason), _sys_iface_state_to_str (priv->sys_iface_state)); + /* in order to prevent triggering any callback caused + * by the device not having any pending action anymore + * we add one here that gets removed at the end of the function */ + nm_device_add_pending_action (self, + NM_PENDING_ACTION_IN_STATE_CHANGE, + TRUE); priv->in_state_changed = TRUE; priv->state = state; @@ -15844,6 +15850,9 @@ _set_state_full (NMDevice *self, concheck_update_interval (self, AF_INET6, concheck_now); priv->in_state_changed = FALSE; + nm_device_remove_pending_action (self, + NM_PENDING_ACTION_IN_STATE_CHANGE, + TRUE); if ((old_state > NM_DEVICE_STATE_UNMANAGED) != (state > NM_DEVICE_STATE_UNMANAGED)) _notify (self, PROP_MANAGED); diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h index 518c66cae2..66f9aa97bd 100644 --- a/src/devices/nm-device.h +++ b/src/devices/nm-device.h @@ -53,6 +53,7 @@ nm_device_state_reason_check (NMDeviceStateReason reason) } #define NM_PENDING_ACTION_AUTOACTIVATE "autoactivate" +#define NM_PENDING_ACTION_IN_STATE_CHANGE "in-state-change" #define NM_PENDING_ACTION_RECHECK_AVAILABLE "recheck-available" #define NM_PENDING_ACTION_CARRIER_WAIT "carrier-wait" #define NM_PENDING_ACTION_WAITING_FOR_SUPPLICANT "waiting-for-supplicant" -- cgit v1.2.1