[lxc-devel] [PATCH] Call dbus_threads_init_default before doing any other dbus calls

S.Çağlar Onur caglar at 10ur.org
Thu Mar 6 04:13:52 UTC 2014


Otherwise concurrent start/stop operations fails

Signed-off-by: S.Çağlar Onur <caglar at 10ur.org>
---
 src/lxc/cgmanager.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/lxc/cgmanager.c b/src/lxc/cgmanager.c
index e7407d8..b4abb47 100644
--- a/src/lxc/cgmanager.c
+++ b/src/lxc/cgmanager.c
@@ -94,6 +94,10 @@ static void cgm_dbus_disconnect(void)
 #define CGMANAGER_DBUS_SOCK "unix:path=/sys/fs/cgroup/cgmanager/sock"
 static bool do_cgm_dbus_connect(void)
 {
+	// D-Bus will do locking, at some cost in efficiency.
+	if (!dbus_threads_init_default())
+		SYSERROR("dbus_threads_init_default failed");
+
 	DBusError dbus_error;
 	dbus_error_init(&dbus_error);
 
-- 
1.8.3.2



More information about the lxc-devel mailing list