diff options
author | Dan Winship <danw@redhat.com> | 2015-01-22 13:59:17 -0500 |
---|---|---|
committer | Dan Winship <danw@redhat.com> | 2015-01-22 13:59:17 -0500 |
commit | 2ac34254c75368573865de8eb511ab4d3bbc77ef (patch) | |
tree | 7c0b851a440f77fbfa9da8ec4a96a6848a3e3dbe | |
parent | 7d2e43a455c2ffa5a68c98cc01265231c529a130 (diff) | |
download | NetworkManager-danw/team-rh1184923.tar.gz |
team: fix teamd startup code (rh #1184923)danw/team-rh1184923
Since 03a5a85d, NMDeviceTeam was trying to use priv->teamd_pid to
decide whether a teamd_dbus_vanished() call indicated "teamd hasn't
been started yet" or "teamd was previously started and has now
exited". But this resulted in a race condition, where at startup, a
device could call g_dbus_watch_name(), then launch teamd (causing
teamd_pid to get set), and then have gdbus report that teamd hasn't
been started yet before the newly-launched teamd managed to grab the
bus name. Since teamd_pid would already be set when
teamd_dbus_vanished() was called, it would decide that this meant
"teamd was previously started and has now exited", so it would call
teamd_cleanup(), killing the just-started teamd process.
Fix this by having teamd_dbus_vanished() check priv->tdc instead,
which doesn't get set until after the first teamd_dbus_appeared()
call.
-rw-r--r-- | src/devices/team/nm-device-team.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/devices/team/nm-device-team.c b/src/devices/team/nm-device-team.c index a03ad3f98b..88b1d0cb01 100644 --- a/src/devices/team/nm-device-team.c +++ b/src/devices/team/nm-device-team.c @@ -351,14 +351,11 @@ teamd_dbus_vanished (GDBusConnection *connection, g_return_if_fail (priv->teamd_dbus_watch); - if (!priv->teamd_pid) { + 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, until the - * startup timeout is over. - * - * Note that g_bus_watch_name is guaranteed to alternate vanished/appeared signals, - * so we won't hit this condition again (because the next signal is either 'appeared' - * or 'timeout'). */ + * name exists/not exists initially. Do not take this as a failure if it hadn't + * previously appeared. + */ _LOGD (LOGD_TEAM, "teamd not on D-Bus (ignored)"); return; } |