diff options
author | Thomas Haller <thaller@redhat.com> | 2013-10-02 17:44:12 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2013-10-02 19:39:17 +0200 |
commit | e4fc7440ccc00a989678804bba246fa542551042 (patch) | |
tree | b3e8cdd46f1f8fe35b626aab2b6f7f6d1df0c992 | |
parent | b573de04087f9187b49cb8f172fab8ed7dec6007 (diff) | |
download | NetworkManager-e4fc7440ccc00a989678804bba246fa542551042.tar.gz |
team: ensure that teamd_start does not get called when already starting
Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r-- | src/devices/nm-device-team.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/devices/nm-device-team.c b/src/devices/nm-device-team.c index e800446708..896e94305f 100644 --- a/src/devices/nm-device-team.c +++ b/src/devices/nm-device-team.c @@ -271,10 +271,10 @@ teamd_timeout_cb (gpointer user_data) NMDevice *dev = NM_DEVICE (user_data); NMDeviceTeamPrivate *priv = NM_DEVICE_TEAM_GET_PRIVATE (dev); - if (priv->teamd_timeout) { - nm_log_info (LOGD_TEAM, "(%s): teamd timed out.", nm_device_get_iface (dev)); - teamd_cleanup (dev); - } + g_return_val_if_fail (priv->teamd_timeout, FALSE); + + nm_log_info (LOGD_TEAM, "(%s): teamd timed out.", nm_device_get_iface (dev)); + teamd_cleanup (dev); return FALSE; } @@ -288,8 +288,7 @@ teamd_dbus_appeared (GDBusConnection *connection, NMDevice *dev = NM_DEVICE (user_data); NMDeviceTeamPrivate *priv = NM_DEVICE_TEAM_GET_PRIVATE (dev); - if (!priv->teamd_dbus_watch) - return; + g_return_if_fail (priv->teamd_dbus_watch); nm_log_info (LOGD_TEAM, "(%s): teamd appeared on D-Bus", nm_device_get_iface (dev)); teamd_timeout_remove (dev); @@ -319,8 +318,8 @@ teamd_dbus_vanished (GDBusConnection *connection, NMDeviceTeamPrivate *priv = NM_DEVICE_TEAM_GET_PRIVATE (dev); NMDeviceState state; - if (!priv->teamd_dbus_watch) - return; + g_return_if_fail (priv->teamd_dbus_watch); + nm_log_info (LOGD_TEAM, "(%s): teamd vanished from D-Bus", nm_device_get_iface (dev)); teamd_cleanup (dev); @@ -379,6 +378,19 @@ teamd_start (NMDevice *dev, NMSettingTeam *s_team, NMDeviceTeamPrivate *priv) gboolean ret; int status; + if (priv->teamd_dbus_watch || + priv->teamd_process_watch || + priv->teamd_pid > 0 || +#if WITH_TEAMDCTL + priv->tdc || +#endif + priv->teamd_timeout) + { + /* FIXME g_assert that this never hits. For now, be more reluctant, and try to recover. */ + g_warn_if_reached (); + teamd_cleanup (dev); + } + teamd_binary = teamd_paths; while (*teamd_binary != NULL) { if (g_file_test (*teamd_binary, G_FILE_TEST_EXISTS)) |