mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-27 17:30:09 +01:00
team: fix handling of D-Bus name watch events
When a device is activated any existing teamd instance is killed. But since commit28274495d6("device/team: always try to connect to teamd in update_connection()") the disappearing of the D-Bus name owner always triggers an automatic restart of the instance in teamd_dbus_vanished() if the name was previously owned. This new instance conflicts with the instance we're about to start. Instead, restore the previous behavior of restarting teamd only if there is an activation in progress and use @tdc as a flag. This also means that update_connection() should not modify the value of @tdc. Fixes:28274495d6
This commit is contained in:
parent
22fc078a39
commit
06ded430e8
1 changed files with 9 additions and 5 deletions
|
|
@ -55,7 +55,6 @@ typedef struct {
|
|||
guint teamd_process_watch;
|
||||
guint teamd_timeout;
|
||||
guint teamd_dbus_watch;
|
||||
gboolean teamd_dbus_name_owned;
|
||||
char *config;
|
||||
} NMDeviceTeamPrivate;
|
||||
|
||||
|
|
@ -180,6 +179,7 @@ update_connection (NMDevice *device, NMConnection *connection)
|
|||
NMDeviceTeam *self = NM_DEVICE_TEAM (device);
|
||||
NMSettingTeam *s_team = nm_connection_get_setting_team (connection);
|
||||
NMDeviceTeamPrivate *priv = NM_DEVICE_TEAM_GET_PRIVATE (self);
|
||||
struct teamdctl *tdc = priv->tdc;
|
||||
|
||||
if (!s_team) {
|
||||
s_team = (NMSettingTeam *) nm_setting_team_new ();
|
||||
|
|
@ -190,6 +190,13 @@ update_connection (NMDevice *device, NMConnection *connection)
|
|||
if (!priv->config && ensure_teamd_connection (device))
|
||||
teamd_read_config (device);
|
||||
|
||||
/* Restore previous tdc state */
|
||||
if (priv->tdc && !tdc) {
|
||||
teamdctl_disconnect (priv->tdc);
|
||||
teamdctl_free (priv->tdc);
|
||||
priv->tdc = NULL;
|
||||
}
|
||||
|
||||
g_object_set (G_OBJECT (s_team), NM_SETTING_TEAM_CONFIG, priv->config, NULL);
|
||||
}
|
||||
|
||||
|
|
@ -321,7 +328,6 @@ teamd_dbus_appeared (GDBusConnection *connection,
|
|||
gboolean success;
|
||||
|
||||
g_return_if_fail (priv->teamd_dbus_watch);
|
||||
priv->teamd_dbus_name_owned = TRUE;
|
||||
|
||||
_LOGI (LOGD_TEAM, "teamd appeared on D-Bus");
|
||||
nm_device_queue_recheck_assume (device);
|
||||
|
|
@ -384,7 +390,7 @@ teamd_dbus_vanished (GDBusConnection *dbus_connection,
|
|||
|
||||
g_return_if_fail (priv->teamd_dbus_watch);
|
||||
|
||||
if (!priv->teamd_dbus_name_owned) {
|
||||
if (!priv->tdc) {
|
||||
/* g_bus_watch_name will always raise an initial signal, to indicate whether the
|
||||
* name exists/not exists initially. Do not take this as a failure if it hadn't
|
||||
* previously appeared.
|
||||
|
|
@ -393,8 +399,6 @@ teamd_dbus_vanished (GDBusConnection *dbus_connection,
|
|||
return;
|
||||
}
|
||||
|
||||
priv->teamd_dbus_name_owned = FALSE;
|
||||
|
||||
_LOGI (LOGD_TEAM, "teamd vanished from D-Bus");
|
||||
teamd_cleanup (device, TRUE);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue