|
|
923a60 |
From 8410dde8d9593c1d96593b17d610d7daf955dab3 Mon Sep 17 00:00:00 2001
|
|
|
923a60 |
From: Michal Sekletar <msekletar@users.noreply.github.com>
|
|
|
923a60 |
Date: Fri, 8 Sep 2017 15:41:44 +0200
|
|
|
923a60 |
Subject: [PATCH] manager: when reexecuting try to connect to bus only when
|
|
|
923a60 |
dbus.service is around (#6773)
|
|
|
923a60 |
|
|
|
923a60 |
Trying to connect otherwise is pointless, because if socket isn't around
|
|
|
923a60 |
we won't connect. However, when dbus.socket is present we attempt to
|
|
|
923a60 |
connect. That attempt can't succeed because we are then supposed
|
|
|
923a60 |
to activate dbus.service as a response to connection from
|
|
|
923a60 |
us. This results in deadlock.
|
|
|
923a60 |
|
|
|
923a60 |
Fixes #6303
|
|
|
923a60 |
|
|
|
923a60 |
(cherry picked from commit 5463fa0a88f95d2002858592578f9bf4e0d2660a)
|
|
|
923a60 |
|
|
|
923a60 |
Resolves: #1465737
|
|
|
923a60 |
---
|
|
|
923a60 |
src/core/manager.c | 9 ++++++---
|
|
|
923a60 |
1 file changed, 6 insertions(+), 3 deletions(-)
|
|
|
923a60 |
|
|
|
923a60 |
diff --git a/src/core/manager.c b/src/core/manager.c
|
|
|
923a60 |
index 287cf6a741..041fac46be 100644
|
|
|
923a60 |
--- a/src/core/manager.c
|
|
|
923a60 |
+++ b/src/core/manager.c
|
|
|
923a60 |
@@ -799,16 +799,19 @@ static int manager_setup_kdbus(Manager *m) {
|
|
|
923a60 |
|
|
|
923a60 |
static int manager_connect_bus(Manager *m, bool reexecuting) {
|
|
|
923a60 |
bool try_bus_connect;
|
|
|
923a60 |
+ Unit *u = NULL;
|
|
|
923a60 |
|
|
|
923a60 |
assert(m);
|
|
|
923a60 |
|
|
|
923a60 |
if (m->test_run)
|
|
|
923a60 |
return 0;
|
|
|
923a60 |
|
|
|
923a60 |
+ u = manager_get_unit(m, SPECIAL_DBUS_SERVICE);
|
|
|
923a60 |
+
|
|
|
923a60 |
try_bus_connect =
|
|
|
923a60 |
- m->kdbus_fd >= 0 ||
|
|
|
923a60 |
- reexecuting ||
|
|
|
923a60 |
- (m->running_as == SYSTEMD_USER && getenv("DBUS_SESSION_BUS_ADDRESS"));
|
|
|
923a60 |
+ (u && UNIT_IS_ACTIVE_OR_RELOADING(unit_active_state(u))) &&
|
|
|
923a60 |
+ (reexecuting ||
|
|
|
923a60 |
+ (m->running_as == SYSTEMD_USER && getenv("DBUS_SESSION_BUS_ADDRESS")));
|
|
|
923a60 |
|
|
|
923a60 |
/* Try to connect to the busses, if possible. */
|
|
|
923a60 |
return bus_init(m, try_bus_connect);
|