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
This commit is contained in:
Antonio Cardace 2020-01-17 15:14:53 +01:00
parent b9820162f2
commit f583aec806
2 changed files with 10 additions and 0 deletions

View file

@ -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);

View file

@ -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"