summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-08-22 13:36:29 +0200
committerThomas Haller <thaller@redhat.com>2019-08-27 12:35:20 +0200
commit3d9ef2fe95cd551f95be4826c33624116fa7209b (patch)
tree10366e63742c5610053d1c714a0d23b0636b2558
parenta0448d50f7fa3d3744d2b1a527ed6f1d39419038 (diff)
downloadNetworkManager-th/act-stage1-re-entrant.tar.gz
device: after stage1 call stage2 synchronouslyth/act-stage1-re-entrant
We know we are ready and in a situation where we can handle state changes. Don't schedule stage2 in an idle handler, just invoke it directly.
-rw-r--r--src/devices/nm-device.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index a024cc65f9..70d538c03c 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -683,6 +683,8 @@ static void (*const activate_stage4_ip_config_timeout_x[2]) (NMDevice *self) = {
static void sriov_op_cb (GError *error, gpointer user_data);
+static void activate_stage2_device_config (NMDevice *self);
+
static void activate_stage5_ip_config_result_4 (NMDevice *self);
static void activate_stage5_ip_config_result_6 (NMDevice *self);
@@ -6257,6 +6259,36 @@ activation_source_schedule (NMDevice *self, ActivationHandleFunc func, int addr_
priv->activation_source_id_x[IS_IPv4] = new_id;
}
+static void
+activation_source_invoke_sync (NMDevice *self, ActivationHandleFunc func, int addr_family)
+{
+ NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
+ const gboolean IS_IPv4 = (addr_family == AF_INET);
+
+ if (priv->activation_source_id_x[IS_IPv4] == 0) {
+ _LOGD (LOGD_DEVICE, "activation-stage: synchronously invoke %s,v%c",
+ _activation_func_to_string (func),
+ nm_utils_addr_family_to_char (addr_family));
+ } else if (priv->activation_source_func_x[IS_IPv4] == func) {
+ _LOGD (LOGD_DEVICE, "activation-stage: synchronously invoke %s,v%c which was already scheduled (id %u)",
+ _activation_func_to_string (func),
+ nm_utils_addr_family_to_char (addr_family),
+ priv->activation_source_id_x[IS_IPv4]);
+ } else {
+ _LOGD (LOGD_DEVICE, "activation-stage: synchronously invoke %s,v%c which replaces %s,v%c (id %u)",
+ _activation_func_to_string (func),
+ nm_utils_addr_family_to_char (addr_family),
+ _activation_func_to_string (priv->activation_source_func_x[IS_IPv4]),
+ nm_utils_addr_family_to_char (addr_family),
+ priv->activation_source_id_x[IS_IPv4]);
+ }
+
+ nm_clear_g_source (&priv->activation_source_id_x[IS_IPv4]);
+ priv->activation_source_func_x[IS_IPv4] = NULL;
+
+ func (self);
+}
+
/*****************************************************************************/
static void
@@ -6585,7 +6617,7 @@ activate_stage1_device_prepare (NMDevice *self)
if (master)
master_ready (self, active);
- nm_device_activate_schedule_stage2_device_config (self);
+ activation_source_invoke_sync (self, activate_stage2_device_config, AF_INET);
}
/*