mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-04-21 15:50:41 +02:00
device: delay startup complete until device is initialized in platform
Udev may be slow at startup and it may take a while until the device is visible in udev. Before that, there are no pending actions yet because the device is still in unmanaged state. Hack nm_device_has_pending_action() to indicate a pending action when the platform link is not yet initialized. We don't bother using nm_device_add_pending_action() to schedule a proper pending-action. It is simpler this way, also we precisely log about the state of NM_UNMANAGED_PLATFORM_INIT flag. The pending actions are implemented in their way mostly for logging purpose to understand what blocks a device. For NM_UNMANAGED_PLATFORM_INIT we have sufficient logging so no need for the overhead and effort. https://bugzilla.gnome.org/show_bug.cgi?id=779920
This commit is contained in:
parent
22b7282d84
commit
6845b9b80a
1 changed files with 21 additions and 1 deletions
|
|
@ -10645,6 +10645,8 @@ _set_unmanaged_flags (NMDevice *self,
|
|||
const char *operation = NULL;
|
||||
char str1[512];
|
||||
char str2[512];
|
||||
gboolean do_notify_has_pending_actions = FALSE;
|
||||
gboolean had_pending_actions = FALSE;
|
||||
|
||||
g_return_if_fail (NM_IS_DEVICE (self));
|
||||
g_return_if_fail (flags);
|
||||
|
|
@ -10680,6 +10682,11 @@ _set_unmanaged_flags (NMDevice *self,
|
|||
nm_assert_se (!nm_clear_g_source (&priv->queued_ip6_config_id));
|
||||
priv->queued_ip6_config_id = g_idle_add (queued_ip6_config_change, self);
|
||||
}
|
||||
|
||||
if (!priv->pending_actions) {
|
||||
do_notify_has_pending_actions = TRUE;
|
||||
had_pending_actions = nm_device_has_pending_action (self);
|
||||
}
|
||||
}
|
||||
|
||||
old_flags = priv->unmanaged_flags;
|
||||
|
|
@ -10739,6 +10746,10 @@ _set_unmanaged_flags (NMDevice *self,
|
|||
""));
|
||||
#undef _FMT
|
||||
|
||||
if ( do_notify_has_pending_actions
|
||||
&& had_pending_actions != nm_device_has_pending_action (self))
|
||||
_notify (self, PROP_HAS_PENDING_ACTION);
|
||||
|
||||
if (transition_state) {
|
||||
new_state = was_managed ? NM_DEVICE_STATE_UNMANAGED : NM_DEVICE_STATE_UNAVAILABLE;
|
||||
if (now)
|
||||
|
|
@ -11412,7 +11423,16 @@ nm_device_has_pending_action (NMDevice *self)
|
|||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
|
||||
return !!priv->pending_actions;
|
||||
if (priv->pending_actions)
|
||||
return TRUE;
|
||||
|
||||
if (nm_device_get_unmanaged_flags (self, NM_UNMANAGED_PLATFORM_INIT)) {
|
||||
/* as long as the platform link is not yet initialized, we have a pending
|
||||
* action. */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue