diff options
author | Antonio Cardace <acardace@redhat.com> | 2020-01-17 15:14:53 +0100 |
---|---|---|
committer | Antonio Cardace <acardace@redhat.com> | 2020-01-27 12:08:53 +0100 |
commit | f583aec8066cefabf2f53b99ea55f3650f785b93 (patch) | |
tree | 76b56fae857dbc24345b880f9d0bdbf523465fb6 | |
parent | b9820162f28df2816e2ae914d02f904bbae731e2 (diff) | |
download | NetworkManager-ac/fix_startup_complete.tar.gz |
nm-device: add new pending action to keep the device busy when in between statesac/fix_startup_complete
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
-rw-r--r-- | src/devices/nm-device.c | 9 | ||||
-rw-r--r-- | src/devices/nm-device.h | 1 |
2 files changed, 10 insertions, 0 deletions
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" |