Blame SOURCES/1001-Revert-core-create-virtual-device-on-settings-change-rh1804350.patch

245932
From c6e479eb14779e42bc7eafdcd913cbdf7bd6c312 Mon Sep 17 00:00:00 2001
245932
From: Beniamino Galvani <bgalvani@redhat.com>
245932
Date: Tue, 18 Feb 2020 19:09:18 +0100
245932
Subject: [PATCH] Revert "core: create virtual device on settings changes in
245932
 idle handler"
245932
245932
When AddConnection() or Update() terminate, the (unrealized) virtual
245932
device should be already be available, otherwise an activation attempt
245932
of that connection can fail.
245932
245932
https://bugzilla.redhat.com/show_bug.cgi?id=1804350
245932
245932
This reverts commit c163207b077a0e66e344b2352ccbe392c76e63ed.
245932
245932
(cherry picked from commit efc04b1285674ba2aea459039f4143b3307b4bcf)
245932
---
245932
 src/nm-manager.c | 51 ++----------------------------------------------
245932
 1 file changed, 2 insertions(+), 49 deletions(-)
245932
245932
diff --git a/src/nm-manager.c b/src/nm-manager.c
245932
index 6d3a5ddbf..7f6657fd7 100644
245932
--- a/src/nm-manager.c
245932
+++ b/src/nm-manager.c
245932
@@ -168,9 +168,6 @@ typedef struct {
245932
 
245932
 	NMSettings *settings;
245932
 
245932
-	CList connection_changed_on_idle_lst;
245932
-	guint connection_changed_on_idle_id;
245932
-
245932
 	RadioState radio_states[RFKILL_TYPE_MAX];
245932
 	NMVpnManager *vpn_manager;
245932
 
245932
@@ -2098,7 +2095,6 @@ static void
245932
 connection_changed (NMManager *self,
245932
                     NMSettingsConnection *sett_conn)
245932
 {
245932
-	NMManagerPrivate *priv;
245932
 	NMConnection *connection;
245932
 	NMDevice *device;
245932
 
245932
@@ -2106,11 +2102,6 @@ connection_changed (NMManager *self,
245932
 	                  NM_SETTINGS_CONNECTION_INT_FLAGS_VOLATILE))
245932
 		return;
245932
 
245932
-	priv = NM_MANAGER_GET_PRIVATE (self);
245932
-
245932
-	if (!nm_settings_has_connection (priv->settings, sett_conn))
245932
-		return;
245932
-
245932
 	connection = nm_settings_connection_get_connection (sett_conn);
245932
 
245932
 	if (!nm_connection_is_virtual (connection))
245932
@@ -2126,46 +2117,12 @@ connection_changed (NMManager *self,
245932
 	retry_connections_for_parent_device (self, device);
245932
 }
245932
 
245932
-static gboolean
245932
-connection_changed_on_idle_cb (gpointer user_data)
245932
-{
245932
-	NMManager *self = user_data;
245932
-	NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
245932
-	NMCListElem *elem;
245932
-
245932
-	priv->connection_changed_on_idle_id = 0;
245932
-
245932
-	while ((elem = c_list_first_entry (&priv->connection_changed_on_idle_lst, NMCListElem, lst))) {
245932
-		gs_unref_object NMSettingsConnection *sett_conn = NULL;
245932
-
245932
-		sett_conn = nm_c_list_elem_free_steal (elem);
245932
-		connection_changed (self, sett_conn);
245932
-	}
245932
-
245932
-	return G_SOURCE_REMOVE;
245932
-}
245932
-
245932
-static void
245932
-connection_changed_on_idle (NMManager *self,
245932
-                            NMSettingsConnection *sett_conn)
245932
-{
245932
-	NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
245932
-
245932
-	if (priv->connection_changed_on_idle_id == 0)
245932
-		priv->connection_changed_on_idle_id = g_idle_add (connection_changed_on_idle_cb, self);
245932
-
245932
-	if (!nm_c_list_elem_find_first_ptr (&priv->connection_changed_on_idle_lst, sett_conn)) {
245932
-		c_list_link_tail (&priv->connection_changed_on_idle_lst,
245932
-		                  &nm_c_list_elem_new_stale (g_object_ref (sett_conn))->lst);
245932
-	}
245932
-}
245932
-
245932
 static void
245932
 connection_added_cb (NMSettings *settings,
245932
                      NMSettingsConnection *sett_conn,
245932
                      NMManager *self)
245932
 {
245932
-	connection_changed_on_idle (self, sett_conn);
245932
+	connection_changed (self, sett_conn);
245932
 }
245932
 
245932
 static void
245932
@@ -2174,7 +2131,7 @@ connection_updated_cb (NMSettings *settings,
245932
                        guint update_reason_u,
245932
                        NMManager *self)
245932
 {
245932
-	connection_changed_on_idle (self, sett_conn);
245932
+	connection_changed (self, sett_conn);
245932
 }
245932
 
245932
 /*****************************************************************************/
245932
@@ -7511,7 +7468,6 @@ nm_manager_init (NMManager *self)
245932
 	c_list_init (&priv->active_connections_lst_head);
245932
 	c_list_init (&priv->async_op_lst_head);
245932
 	c_list_init (&priv->delete_volatile_connection_lst_head);
245932
-	c_list_init (&priv->connection_changed_on_idle_lst);
245932
 
245932
 	priv->platform = g_object_ref (NM_PLATFORM_GET);
245932
 
245932
@@ -7817,9 +7773,6 @@ dispose (GObject *object)
245932
 		g_clear_object (&priv->policy);
245932
 	}
245932
 
245932
-	nm_clear_g_source (&priv->connection_changed_on_idle_id);
245932
-	nm_c_list_elem_free_all (&priv->connection_changed_on_idle_lst, g_object_unref);
245932
-
245932
 	if (priv->settings) {
245932
 		g_signal_handlers_disconnect_by_func (priv->settings, settings_startup_complete_changed, self);
245932
 		g_signal_handlers_disconnect_by_func (priv->settings, system_unmanaged_devices_changed_cb, self);
245932
-- 
245932
2.24.1
245932