summaryrefslogtreecommitdiff
path: root/src/nm-manager.c
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2020-07-16 11:57:14 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2020-07-21 09:00:52 +0200
commitfe2d93980bd5b61c55a8b65a55f7aad35042e691 (patch)
tree5f00974fdf062d46589a711715a3ae5c06ec6be3 /src/nm-manager.c
parente73bd2cf5f933f770971adc40fbb4129d23379db (diff)
downloadNetworkManager-fe2d93980bd5b61c55a8b65a55f7aad35042e691.tar.gz
manager: fix race condition when resuming from sleep
If the device state change (to disconnected or unmanaged) triggered by a sleep event happens after the wake, the devices becomes wrongly unmanaged and it's necessary to manually manage it again, or restart NM. During the wake event we should disconnect the device_sleep_cb() callback for all devices because we don't want to react to state changes anymore; in particular we don't need to detect when the device becomes disconnected to unmanage it.
Diffstat (limited to 'src/nm-manager.c')
-rw-r--r--src/nm-manager.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nm-manager.c b/src/nm-manager.c
index 7ad7b2640e..5e3b9b44ca 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -6048,8 +6048,9 @@ do_sleep_wake (NMManager *self, gboolean sleeping_changed)
} else {
_LOGD (LOGD_SUSPEND, "sleep: %s...", waking_from_suspend ? "waking up" : "re-enabling");
+ sleep_devices_clear (self);
+
if (waking_from_suspend) {
- sleep_devices_clear (self);
c_list_for_each_entry (device, &priv->devices_lst_head, devices_lst) {
if (nm_device_is_software (device))
continue;