|
|
386167 |
From 5ca09aea057bcfe271c2bb35318c82162a0bd8c7 Mon Sep 17 00:00:00 2001
|
|
|
386167 |
From: Dan Winship <danw@redhat.com>
|
|
|
386167 |
Date: Thu, 22 Jan 2015 13:59:17 -0500
|
|
|
386167 |
Subject: [PATCH] team: fix teamd startup code (rh #1184923)
|
|
|
386167 |
|
|
|
386167 |
Since 03a5a85d, NMDeviceTeam was trying to use priv->teamd_pid to
|
|
|
386167 |
decide whether a teamd_dbus_vanished() call indicated "teamd hasn't
|
|
|
386167 |
been started yet" or "teamd was previously started and has now
|
|
|
386167 |
exited". But this resulted in a race condition, where at startup, a
|
|
|
386167 |
device could call g_dbus_watch_name(), then launch teamd (causing
|
|
|
386167 |
teamd_pid to get set), and then have gdbus report that teamd hasn't
|
|
|
386167 |
been started yet before the newly-launched teamd managed to grab the
|
|
|
386167 |
bus name. Since teamd_pid would already be set when
|
|
|
386167 |
teamd_dbus_vanished() was called, it would decide that this meant
|
|
|
386167 |
"teamd was previously started and has now exited", so it would call
|
|
|
386167 |
teamd_cleanup(), killing the just-started teamd process.
|
|
|
386167 |
|
|
|
386167 |
Fix this by having teamd_dbus_vanished() check priv->tdc instead,
|
|
|
386167 |
which doesn't get set until after the first teamd_dbus_appeared()
|
|
|
386167 |
call.
|
|
|
386167 |
---
|
|
|
386167 |
src/devices/team/nm-device-team.c | 11 ++++-------
|
|
|
386167 |
1 file changed, 4 insertions(+), 7 deletions(-)
|
|
|
386167 |
|
|
|
386167 |
diff --git a/src/devices/team/nm-device-team.c b/src/devices/team/nm-device-team.c
|
|
|
386167 |
index a03ad3f..88b1d0c 100644
|
|
|
386167 |
--- a/src/devices/team/nm-device-team.c
|
|
|
386167 |
+++ b/src/devices/team/nm-device-team.c
|
|
|
386167 |
@@ -351,14 +351,11 @@ teamd_dbus_vanished (GDBusConnection *connection,
|
|
|
386167 |
|
|
|
386167 |
g_return_if_fail (priv->teamd_dbus_watch);
|
|
|
386167 |
|
|
|
386167 |
- if (!priv->teamd_pid) {
|
|
|
386167 |
+ if (!priv->tdc) {
|
|
|
386167 |
/* g_bus_watch_name will always raise an initial signal, to indicate whether the
|
|
|
386167 |
- * name exists/not exists initially. Do not take this as a failure, until the
|
|
|
386167 |
- * startup timeout is over.
|
|
|
386167 |
- *
|
|
|
386167 |
- * Note that g_bus_watch_name is guaranteed to alternate vanished/appeared signals,
|
|
|
386167 |
- * so we won't hit this condition again (because the next signal is either 'appeared'
|
|
|
386167 |
- * or 'timeout'). */
|
|
|
386167 |
+ * name exists/not exists initially. Do not take this as a failure if it hadn't
|
|
|
386167 |
+ * previously appeared.
|
|
|
386167 |
+ */
|
|
|
386167 |
_LOGD (LOGD_TEAM, "teamd not on D-Bus (ignored)");
|
|
|
386167 |
return;
|
|
|
386167 |
}
|
|
|
386167 |
--
|
|
|
386167 |
1.9.3
|
|
|
386167 |
|