summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2014-10-16 15:01:16 -0500
committerDan Williams <dcbw@redhat.com>2015-04-27 14:00:59 -0500
commitd9c537ec64d2ffae36c0c28d8bef77d7346e7837 (patch)
tree47c61c387a86829594abf51a47e966877ce6495b
parent4b7015aae8c195a67bc88d5b35743d616a0413ba (diff)
downloadNetworkManager-d9c537ec64d2ffae36c0c28d8bef77d7346e7837.tar.gz
core: don't activate failed queued activation requests
If the queued activation request failed before the device is finished deactiving the old request, don't start activating the failed queued request.
-rw-r--r--src/devices/nm-device.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 1de4e4730b..e9cf3b6097 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -5811,14 +5811,20 @@ impl_device_delete (NMDevice *self, DBusGMethodInvocation *context)
NULL);
}
-static void
+static gboolean
_device_activate (NMDevice *self, NMActRequest *req)
{
NMDevicePrivate *priv;
NMConnection *connection;
- g_return_if_fail (NM_IS_DEVICE (self));
- g_return_if_fail (NM_IS_ACT_REQUEST (req));
+ g_return_val_if_fail (NM_IS_DEVICE (self), FALSE);
+ g_return_val_if_fail (NM_IS_ACT_REQUEST (req), FALSE);
+
+ /* Ensure the activation request is still valid; the master may have
+ * already failed in which case activation of this device should not proceed.
+ */
+ if (nm_active_connection_get_state (NM_ACTIVE_CONNECTION (req)) >= NM_ACTIVE_CONNECTION_STATE_DEACTIVATING)
+ return FALSE;
priv = NM_DEVICE_GET_PRIVATE (self);
@@ -5844,6 +5850,7 @@ _device_activate (NMDevice *self, NMActRequest *req)
priv->act_request = g_object_ref (req);
nm_device_activate_schedule_stage1_device_prepare (self);
+ return TRUE;
}
static void
@@ -5939,7 +5946,7 @@ nm_device_queue_activation (NMDevice *self, NMActRequest *req)
if (!priv->act_request && !must_queue) {
/* Just activate immediately */
- _device_activate (self, req);
+ g_assert (_device_activate (self, req));
return;
}
@@ -8023,13 +8030,18 @@ _set_state_full (NMDevice *self,
if ( priv->queued_act_request
&& !priv->queued_act_request_is_waiting_for_carrier) {
NMActRequest *queued_req;
+ gboolean success;
queued_req = priv->queued_act_request;
priv->queued_act_request = NULL;
- _device_activate (self, queued_req);
+ success = _device_activate (self, queued_req);
g_object_unref (queued_req);
- } else if ( old_state > NM_DEVICE_STATE_DISCONNECTED
- && nm_device_get_default_unmanaged (self))
+ if (success)
+ break;
+ /* fall through */
+ }
+ if ( old_state > NM_DEVICE_STATE_DISCONNECTED
+ && nm_device_get_default_unmanaged (self))
nm_device_queue_state (self, NM_DEVICE_STATE_UNMANAGED, NM_DEVICE_STATE_REASON_NONE);
break;
case NM_DEVICE_STATE_ACTIVATED: