Blob Blame History Raw
From a1198f4f6d95682bc4126fe4f13d8c549394d8b6 Mon Sep 17 00:00:00 2001
From: Beniamino Galvani <bgalvani@redhat.com>
Date: Tue, 14 Jul 2020 22:52:56 +0200
Subject: [PATCH] team: perform cleanup immediately when connecting to teamd
 fails

When NM fails to connect to teamd during an activation, it sets the
device state to FAILED. Eventually the device will become DISCONNECTED
and will call the ->deactivate() method that will perform the cleanup
of timers, teamd process and teamdctl instance.

However, in this way, when the device is DISCONNECTED timers are still
armed and can be triggered in the wrong state. Instead, perform the
cleanup immediately on failure.

https://bugzilla.redhat.com/show_bug.cgi?id=1856723
(cherry picked from commit 26e97fcd0d4a70e32a484d3bfc57c1802da10554)
(cherry picked from commit 680c0b88122077101cbfd878a70d54fb7a4afcea)
---
 src/devices/team/nm-device-team.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/devices/team/nm-device-team.c b/src/devices/team/nm-device-team.c
index 217c4bdd7c..7ba3034212 100644
--- a/src/devices/team/nm-device-team.c
+++ b/src/devices/team/nm-device-team.c
@@ -371,6 +371,7 @@ teamd_ready (NMDeviceTeam *self)
 		success = teamd_read_config (self);
 
 	if (!success) {
+		teamd_cleanup (self, TRUE);
 		nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_TEAMD_CONTROL_FAILED);
 		return;
 	}
-- 
2.26.2