From 7f191eb15be0f0ee1dbd586b423c6d600d4864c9 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Wed, 29 Jun 2016 14:20:02 +0200 Subject: [PATCH] device: fail slave activation if master is deactivating When the master connection deactivates, we also fail slave connections; but if the master deactivation happens just before a slave reaches the PREPARE state, we failed to notice it and keep the slave stuck without chance of progressing. Fix this. --- src/devices/nm-device.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 4e955076ac..93d63a0411 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -3954,15 +3954,21 @@ nm_device_activate_schedule_stage2_device_config (NMDevice *self) if (!priv->master_ready_handled) { NMActiveConnection *active = NM_ACTIVE_CONNECTION (priv->act_request); + NMActiveConnection *master; - if (!nm_active_connection_get_master (active)) { + master = nm_active_connection_get_master (active); + + if (!master) { g_warn_if_fail (!priv->master_ready_id); priv->master_ready_handled = TRUE; } else { /* If the master connection is ready for slaves, attach ourselves */ if (nm_active_connection_get_master_ready (active)) master_ready (self, active); - else { + else if (nm_active_connection_get_state (master) >= NM_ACTIVE_CONNECTION_STATE_DEACTIVATING) { + _LOGD (LOGD_DEVICE, "master connection is deactivating"); + nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED); + } else { _LOGD (LOGD_DEVICE, "waiting for master connection to become ready"); if (priv->master_ready_id == 0) {