diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2019-04-04 18:53:03 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2019-04-08 09:31:49 +0200 |
commit | fc5003f7509e9136cfc4e3d603901ec485a4850e (patch) | |
tree | cbe129cf5d9c2876f4d8ca9c01f6c3b7d77a85a4 | |
parent | bfe75c957578f9b8949f905c4d0fe2612aeceb7a (diff) | |
download | NetworkManager-fc5003f7509e9136cfc4e3d603901ec485a4850e.tar.gz |
device: don't shortcut slave state when the master releases it
In general shortcutting state is a no-no. But putting a device to FAILED
state because its master is going down is a crime. It's the wrong state:
the devices should enter it when their connections themselves failed
unexpectedly, and can potentially recover with another actiation.
Otherwise bad things happen,
In particular, the devices automatically enter DISCONNECTED state and
eventually retry autoconnecting. In this case they would attempt to
bring the master back up. Ugh.
This situation happens when a topomost master of multiple levels of
master-slave relationship is deactivated.
Aside from that, shortcutting to DISCONNECTED on unknown change reason
doesn't make sense either. Like, wtf, just traverse through DEACTIVATING
like all the other kids do.
-rw-r--r-- | src/devices/nm-device.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 1b594ce000..06ad2ce821 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -5075,7 +5075,6 @@ nm_device_slave_notify_release (NMDevice *self, NMDeviceStateReason reason) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMConnection *connection = nm_device_get_applied_connection (self); - NMDeviceState new_state; const char *master_status; g_return_if_fail (priv->master); @@ -5084,21 +5083,17 @@ nm_device_slave_notify_release (NMDevice *self, NMDeviceStateReason reason) && priv->state <= NM_DEVICE_STATE_ACTIVATED) { switch (nm_device_state_reason_check (reason)) { case NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED: - new_state = NM_DEVICE_STATE_FAILED; master_status = "failed"; break; case NM_DEVICE_STATE_REASON_USER_REQUESTED: - new_state = NM_DEVICE_STATE_DEACTIVATING; reason = NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED; master_status = "deactivated by user request"; break; case NM_DEVICE_STATE_REASON_CONNECTION_REMOVED: - new_state = NM_DEVICE_STATE_DEACTIVATING; reason = NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED; master_status = "deactivated because master was removed"; break; default: - new_state = NM_DEVICE_STATE_DISCONNECTED; master_status = "deactivated"; break; } @@ -5109,7 +5104,7 @@ nm_device_slave_notify_release (NMDevice *self, NMDeviceStateReason reason) /* Cancel any pending activation sources */ _cancel_activation (self); - nm_device_queue_state (self, new_state, reason); + nm_device_queue_state (self, NM_DEVICE_STATE_DEACTIVATING, reason); } else _LOGI (LOGD_DEVICE, "released from master device %s", nm_device_get_iface (priv->master)); |