summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2022-08-31 10:55:56 +0200
committerLubomir Rintel <lkundrak@v3.sk>2022-09-05 09:40:07 +0200
commit999d39944ea8968931c17f791294eded379001fa (patch)
tree2e7f3c64fd11302a74740a5a1a7684965d0b6d86
parentfc2281dffc87e445d51c3ac5ebe611fb481298c2 (diff)
downloadNetworkManager-999d39944ea8968931c17f791294eded379001fa.tar.gz
team: back off a little when re-spawning teamd
It might have dropped off for a reason (e.g. D-Bus itself has gone away, because the system is transitioning from initrd to real root). Give things a few seconds to cool off, just to be nice. That shouldn't be a big deal, the link should still be operational.
-rw-r--r--src/core/devices/team/nm-device-team.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/core/devices/team/nm-device-team.c b/src/core/devices/team/nm-device-team.c
index d90b766bdb..f852cb6aec 100644
--- a/src/core/devices/team/nm-device-team.c
+++ b/src/core/devices/team/nm-device-team.c
@@ -39,6 +39,7 @@ typedef struct {
guint teamd_process_watch;
guint teamd_timeout;
guint teamd_read_timeout;
+ guint teamd_backoff;
guint teamd_dbus_watch;
bool kill_in_progress : 1;
GFileMonitor *usock_monitor;
@@ -337,6 +338,7 @@ teamd_cleanup(NMDeviceTeam *self, gboolean free_tdc)
nm_clear_g_source(&priv->teamd_process_watch);
nm_clear_g_source(&priv->teamd_timeout);
nm_clear_g_source(&priv->teamd_read_timeout);
+ nm_clear_g_source(&priv->teamd_backoff);
if (priv->teamd_pid > 0) {
priv->kill_in_progress = TRUE;
@@ -431,9 +433,10 @@ teamd_ready(NMDeviceTeam *self)
nm_device_activate_schedule_stage1_device_prepare(device, FALSE);
}
-static void
-teamd_gone(NMDeviceTeam *self)
+static gboolean
+teamd_backoff_cb(gpointer user_data)
{
+ NMDeviceTeam *self = NM_DEVICE_TEAM(user_data);
NMDevice *device = NM_DEVICE(self);
NMDeviceState state;
@@ -448,6 +451,19 @@ teamd_gone(NMDeviceTeam *self)
NM_DEVICE_STATE_REASON_TEAMD_CONTROL_FAILED);
}
}
+
+ return G_SOURCE_REMOVE;
+}
+
+static void
+teamd_gone(NMDeviceTeam *self)
+{
+ /* Wait a little before respawning. Something unexpected has happened
+ * causing teamd to disappear and we need to be careful. Maybe a clumsy
+ * supervisor is just killing off all processes and it's not too nice
+ * if we respawn too quickly. */
+ NM_DEVICE_TEAM_GET_PRIVATE(self)->teamd_backoff =
+ g_timeout_add_seconds(5, teamd_backoff_cb, self);
}
static void