From 4d0cf4924f6c394f3bb53e04fca14c8acca37c0e Mon Sep 17 00:00:00 2001 From: Wen Liang Date: Fri, 8 Sep 2023 10:45:17 -0400 Subject: [PATCH] device: do not set dependency failed for port if master is reconnecting When a master is re-enslaved, it will be deactivated and reconnecting immediately, as a result, we should not set the dependency-failed for its port. Otherwise, we may risk blocking the autoconnect of port connections with higher autoconnect-priority. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1725 https://gitlab.freedesktop.org/NetworkManager/NetworkManager-ci/-/merge_requests/1473 --- src/core/devices/nm-device.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c index 47d17a200b..1fc85ad135 100644 --- a/src/core/devices/nm-device.c +++ b/src/core/devices/nm-device.c @@ -9746,10 +9746,16 @@ activate_stage1_device_prepare(NMDevice *self) master = nm_active_connection_get_master(active); if (master) { if (nm_active_connection_get_state(master) >= NM_ACTIVE_CONNECTION_STATE_DEACTIVATING) { + NMDevice *master_device = nm_active_connection_get_device(master); + NMDeviceStateReason failure_reason = NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED; + _LOGD(LOGD_DEVICE, "master connection is deactivating"); - nm_device_state_changed(self, - NM_DEVICE_STATE_FAILED, - NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED); + + if (master_device && NM_DEVICE_GET_PRIVATE(master_device)->queued_act_request) { + /* if the controller is going to activate again, don't block this device */ + failure_reason = NM_DEVICE_STATE_REASON_NONE; + } + nm_device_state_changed(self, NM_DEVICE_STATE_FAILED, failure_reason); return; } /* If the master connection is ready for slaves, attach ourselves */