Commit 6845b9b8 authored by Thomas Haller's avatar Thomas Haller

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.
parent 22b7282d
......@@ -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) {
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;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment