summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2013-12-16 15:02:38 +0100
committerDan Williams <dcbw@redhat.com>2013-12-18 09:40:49 -0600
commit799fd3f7f39d2c4b00511081730e12bd5285a92b (patch)
treef4a8e059f7cf1bb5099f3f02ed4f374cc8babb98
parentdfe5916c4b1f1724164aa8debdd38effc1e7b0f4 (diff)
downloadNetworkManager-dcbw/pending_actions.tar.gz
core: fix NMActiveConnection to properly add/remove pending action "activation"dcbw/pending_actions
When a new activation request is received, NetworkManager creates a new NMActiveConnection to track that request. The device may already be activated, in which case NetworkManager stops the old activation and starts the new one, but both exist in parallel for a short period of time. If the old NMActiveConnection is activating and already has a pending 'activation' action, when the new NMActiveConnection adds its own 'activating' action, they will clash. This is fixed by making each NMActiveConnection's activation pending action uniquely named. This fixes a g_warning with the following back trace: #0 0x000000328224edfd in g_logv () from /lib64/libglib-2.0.so.0 #1 0x000000328224efe2 in g_log () from /lib64/libglib-2.0.so.0 #2 0x000000328224f2e6 in g_warn_message () from /lib64/libglib-2.0.so.0 #3 0x0000000000440aee in nm_device_add_pending_action (device=0x14002e0, action=0x50704a "activation") at devices/nm-device.c:7172 #4 0x000000000047525c in nm_active_connection_set_device (self=0x141b3c0, device=0x14002e0) at nm-active-connection.c:364 #5 0x0000000000475ec1 in set_property (object=0x141b3c0, prop_id=11, value=0x7fff7ff36c20, pspec=0x1405f70) at nm-active-connection.c:647 #6 0x0000003282615d3e in g_object_newv () from /lib64/libgobject-2.0.so.0 #7 0x00000032826162e6 in g_object_new_valist () from /lib64/libgobject-2.0.so.0 #8 0x0000003282616654 in g_object_new () from /lib64/libgobject-2.0.so.0 #9 0x0000000000474193 in nm_act_request_new (connection=0x13bb0e0, specific_object=0x0, subject=0x1447740, device=0x14002e0) at nm-activation-request.c:376 #10 0x000000000048e477 in _new_active_connection (self=0x13e8060, connection=0x13bb0e0, specific_object=0x0, device=0x14002e0, subject=0x1447740, error=0x7fff7ff36f90) at nm-manager.c:2947 #11 0x000000000048ed77 in impl_manager_activate_connection (self=0x13e8060, connection_path=0x134d590 "/org/freedesktop/NetworkManager/Settings/9", device_path=0x134d550 "/org/freedesktop/NetworkManager/Devices/1", specific_object_path=0x0, context=0x143a9b0) at nm-manager.c:3206 #12 0x00000000004876c8 in dbus_glib_marshal_nm_manager_VOID__BOXED_BOXED_BOXED_POINTER (closure=0x7fff7ff37220, return_value=0x0, n_param_values=5, param_values=0x1448830, invocation_hint=0x0, marshal_data=0x48e9dd <impl_manager_activate_connection>) at nm-manager-glue.h:189 #13 0x0000003284a0d6a9 in object_registration_message () from /lib64/libdbus-glib-1.so.2 #14 0x000000348ea1ce66 in _dbus_object_tree_dispatch_and_unlock () from /lib64/libdbus-1.so.3 #15 0x000000348ea0fa31 in dbus_connection_dispatch () from /lib64/libdbus-1.so.3 #16 0x0000003284a0acc5 in message_queue_dispatch () from /lib64/libdbus-glib-1.so.2 #17 0x0000003282247df6 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0 #18 0x0000003282248148 in g_main_context_iterate.isra.22 () from /lib64/libglib-2.0.so.0 #19 0x000000328224854a in g_main_loop_run () from /lib64/libglib-2.0.so.0 #20 0x000000000042c6c0 in main (argc=1, argv=0x7fff7ff379b8) at main.c:629 Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r--src/nm-active-connection.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c
index cb4241735f..a8a422c158 100644
--- a/src/nm-active-connection.c
+++ b/src/nm-active-connection.c
@@ -46,6 +46,8 @@ typedef struct {
NMDevice *device;
guint32 device_state_id;
+ char *pending_activation_id;
+
gboolean is_default;
gboolean is_default6;
NMActiveConnectionState state;
@@ -142,8 +144,12 @@ nm_active_connection_set_state (NMActiveConnection *self,
if (priv->device) {
if ( old_state < NM_ACTIVE_CONNECTION_STATE_ACTIVATED
- && new_state >= NM_ACTIVE_CONNECTION_STATE_ACTIVATED)
- nm_device_remove_pending_action (priv->device, "activation");
+ && new_state >= NM_ACTIVE_CONNECTION_STATE_ACTIVATED &&
+ priv->pending_activation_id)
+ {
+ nm_device_remove_pending_action (priv->device, priv->pending_activation_id);
+ g_clear_pointer (&priv->pending_activation_id, g_free);
+ }
}
if (priv->state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATED) {
@@ -361,7 +367,8 @@ nm_active_connection_set_device (NMActiveConnection *self, NMDevice *device)
G_CALLBACK (device_state_changed),
self);
- nm_device_add_pending_action (device, "activation");
+ priv->pending_activation_id = g_strdup_printf ("activation::%p", (void *)self);
+ nm_device_add_pending_action (device, priv->pending_activation_id);
}
return TRUE;
}
@@ -736,6 +743,10 @@ _device_cleanup (NMActiveConnectionPrivate *priv)
g_signal_handler_disconnect (priv->device, priv->device_state_id);
priv->device_state_id = 0;
}
+ if (priv->pending_activation_id) {
+ nm_device_remove_pending_action (priv->device, priv->pending_activation_id);
+ g_clear_pointer (&priv->pending_activation_id, g_free);
+ }
g_clear_object (&priv->device);
}