systemd-239-82.6
Resolves: RHEL-75081
This commit is contained in:
parent
a81c479dad
commit
f11fa5b08f
171
1026-dbus-stash-the-subscriber-list-when-we-disconenct-fr.patch
Normal file
171
1026-dbus-stash-the-subscriber-list-when-we-disconenct-fr.patch
Normal file
@ -0,0 +1,171 @@
|
||||
From dd01fc11f599dbfe0a1d5a42e60f9364ae991d31 Mon Sep 17 00:00:00 2001
|
||||
From: Ronan Pigott <ronan@rjp.ie>
|
||||
Date: Fri, 18 Jul 2025 15:10:03 +0200
|
||||
Subject: [PATCH] dbus: stash the subscriber list when we disconenct from the
|
||||
bus
|
||||
|
||||
If we unexpectly disconnect from the bus, systemd would end up dropping
|
||||
the list of subscribers, which breaks the ability of clients like logind
|
||||
to monitor the state of units.
|
||||
|
||||
Stash the list of subscribers into the deserialized state in the event
|
||||
of a disconnect so that when we recover we can renew the broken
|
||||
subscriptions.
|
||||
|
||||
(cherry picked from commit 8402ca04d1a063c3d8a9e3d5c16df8bb8778ae98)
|
||||
|
||||
Related: RHEL-75081
|
||||
---
|
||||
src/core/dbus.c | 23 ++++++++++++++++-------
|
||||
src/core/dbus.h | 2 +-
|
||||
src/core/manager.c | 5 ++++-
|
||||
src/shared/bus-util.c | 22 ++++++++++++++++++++++
|
||||
src/shared/bus-util.h | 1 +
|
||||
5 files changed, 44 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/src/core/dbus.c b/src/core/dbus.c
|
||||
index ec6c52cb85..1b8bb44eda 100644
|
||||
--- a/src/core/dbus.c
|
||||
+++ b/src/core/dbus.c
|
||||
@@ -908,6 +908,8 @@ int bus_init_api(Manager *m) {
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to set up API bus: %m");
|
||||
|
||||
+ (void) bus_track_coldplug(bus, &m->subscribed, /* recursive= */ false, m->deserialized_subscribed);
|
||||
+ m->deserialized_subscribed = strv_free(m->deserialized_subscribed);
|
||||
m->api_bus = TAKE_PTR(bus);
|
||||
|
||||
r = manager_enqueue_sync_bus_names(m);
|
||||
@@ -1070,8 +1072,17 @@ static void destroy_bus(Manager *m, sd_bus **bus) {
|
||||
}
|
||||
|
||||
/* Get rid of tracked clients on this bus */
|
||||
- if (m->subscribed && sd_bus_track_get_bus(m->subscribed) == *bus)
|
||||
+ if (m->subscribed && sd_bus_track_get_bus(m->subscribed) == *bus) {
|
||||
+ _cleanup_strv_free_ char **subscribed = NULL;
|
||||
+ int r;
|
||||
+
|
||||
+ r = bus_track_to_strv(m->subscribed, &subscribed);
|
||||
+ if (r < 0)
|
||||
+ log_warning_errno(r, "Failed to serialize api subscribers, ignoring: %m");
|
||||
+ strv_free_and_replace(m->deserialized_subscribed, subscribed);
|
||||
+
|
||||
m->subscribed = sd_bus_track_unref(m->subscribed);
|
||||
+ }
|
||||
|
||||
HASHMAP_FOREACH(j, m->jobs, i)
|
||||
if (j->bus_track && sd_bus_track_get_bus(j->bus_track) == *bus)
|
||||
@@ -1131,7 +1142,6 @@ void bus_done(Manager *m) {
|
||||
|
||||
assert(!m->subscribed);
|
||||
|
||||
- m->deserialized_subscribed = strv_free(m->deserialized_subscribed);
|
||||
bus_verify_polkit_async_registry_free(m->polkit_registry);
|
||||
}
|
||||
|
||||
@@ -1229,20 +1239,19 @@ void bus_track_serialize(sd_bus_track *t, FILE *f, const char *prefix) {
|
||||
}
|
||||
}
|
||||
|
||||
-int bus_track_coldplug(Manager *m, sd_bus_track **t, bool recursive, char **l) {
|
||||
- int r = 0;
|
||||
+int bus_track_coldplug(sd_bus *bus, sd_bus_track **t, bool recursive, char **l) {
|
||||
+ int r;
|
||||
|
||||
- assert(m);
|
||||
assert(t);
|
||||
|
||||
if (strv_isempty(l))
|
||||
return 0;
|
||||
|
||||
- if (!m->api_bus)
|
||||
+ if (!bus)
|
||||
return 0;
|
||||
|
||||
if (!*t) {
|
||||
- r = sd_bus_track_new(m->api_bus, t, NULL, NULL);
|
||||
+ r = sd_bus_track_new(bus, t, NULL, NULL);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
diff --git a/src/core/dbus.h b/src/core/dbus.h
|
||||
index f1c0fa86c0..402c970d74 100644
|
||||
--- a/src/core/dbus.h
|
||||
+++ b/src/core/dbus.h
|
||||
@@ -19,7 +19,7 @@ void bus_done(Manager *m);
|
||||
int bus_fdset_add_all(Manager *m, FDSet *fds);
|
||||
|
||||
void bus_track_serialize(sd_bus_track *t, FILE *f, const char *prefix);
|
||||
-int bus_track_coldplug(Manager *m, sd_bus_track **t, bool recursive, char **l);
|
||||
+int bus_track_coldplug(sd_bus *bus, sd_bus_track **t, bool recursive, char **l);
|
||||
|
||||
int manager_enqueue_sync_bus_names(Manager *m);
|
||||
|
||||
diff --git a/src/core/manager.c b/src/core/manager.c
|
||||
index e09227d5ac..c5d906e42e 100644
|
||||
--- a/src/core/manager.c
|
||||
+++ b/src/core/manager.c
|
||||
@@ -1348,6 +1348,9 @@ Manager* manager_free(Manager *m) {
|
||||
free(m->switch_root);
|
||||
free(m->switch_root_init);
|
||||
|
||||
+ sd_bus_track_unref(m->subscribed);
|
||||
+ strv_free(m->deserialized_subscribed);
|
||||
+
|
||||
rlimit_free_all(m->rlimit);
|
||||
|
||||
assert(hashmap_isempty(m->units_requiring_mounts_for));
|
||||
@@ -1656,7 +1659,7 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
|
||||
manager_setup_bus(m);
|
||||
|
||||
/* Now that we are connected to all possible busses, let's deserialize who is tracking us. */
|
||||
- (void) bus_track_coldplug(m, &m->subscribed, false, m->deserialized_subscribed);
|
||||
+ (void) bus_track_coldplug(m->api_bus, &m->subscribed, false, m->deserialized_subscribed);
|
||||
m->deserialized_subscribed = strv_free(m->deserialized_subscribed);
|
||||
|
||||
/* Third, fire things up! */
|
||||
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
|
||||
index ff0e800347..5ce4613262 100644
|
||||
--- a/src/shared/bus-util.c
|
||||
+++ b/src/shared/bus-util.c
|
||||
@@ -1694,6 +1694,28 @@ int bus_track_add_name_many(sd_bus_track *t, char **l) {
|
||||
return r;
|
||||
}
|
||||
|
||||
+int bus_track_to_strv(sd_bus_track *t, char ***ret) {
|
||||
+ _cleanup_strv_free_ char **subscribed = NULL;
|
||||
+ int r = 0;
|
||||
+
|
||||
+ assert(ret);
|
||||
+
|
||||
+ for (const char *n = sd_bus_track_first(t); n; n = sd_bus_track_next(t)) {
|
||||
+ r = sd_bus_track_count_name(t, n);
|
||||
+ if (r < 0)
|
||||
+ return r;
|
||||
+
|
||||
+ for (int j = 0; j < r; j++) {
|
||||
+ r = strv_extend(&subscribed, n);
|
||||
+ if (r < 0)
|
||||
+ return r;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ *ret = TAKE_PTR(subscribed);
|
||||
+ return r;
|
||||
+}
|
||||
+
|
||||
int bus_open_system_watch_bind_with_description(sd_bus **ret, const char *description) {
|
||||
_cleanup_(sd_bus_unrefp) sd_bus *bus = NULL;
|
||||
const char *e;
|
||||
diff --git a/src/shared/bus-util.h b/src/shared/bus-util.h
|
||||
index b400eb81e2..b3aa62e6e5 100644
|
||||
--- a/src/shared/bus-util.h
|
||||
+++ b/src/shared/bus-util.h
|
||||
@@ -171,6 +171,7 @@ int bus_path_decode_unique(const char *path, const char *prefix, char **ret_send
|
||||
int bus_property_get_rlimit(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error);
|
||||
|
||||
int bus_track_add_name_many(sd_bus_track *t, char **l);
|
||||
+int bus_track_to_strv(sd_bus_track *t, char ***ret);
|
||||
|
||||
int bus_open_system_watch_bind_with_description(sd_bus **ret, const char *description);
|
||||
static inline int bus_open_system_watch_bind(sd_bus **ret) {
|
||||
@ -0,0 +1,87 @@
|
||||
From 1cf170260b78e550ed0a0cd3b729527852de0991 Mon Sep 17 00:00:00 2001
|
||||
From: Ronan Pigott <ronan@rjp.ie>
|
||||
Date: Fri, 18 Jul 2025 15:12:31 +0200
|
||||
Subject: [PATCH] manager: s/deserialized_subscribed/subscribed_as_strv
|
||||
|
||||
Now that this field may get populated at runtime, the deserialized name
|
||||
is misleading. Change the name to reflect its updated purpose.
|
||||
|
||||
(cherry picked from commit e1315a621ae26473fcc9cd0d6013836f5f498d40)
|
||||
|
||||
Related: RHEL-75081
|
||||
---
|
||||
src/core/dbus.c | 6 +++---
|
||||
src/core/manager.c | 8 ++++----
|
||||
src/core/manager.h | 2 +-
|
||||
3 files changed, 8 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/src/core/dbus.c b/src/core/dbus.c
|
||||
index 1b8bb44eda..9f439dcb23 100644
|
||||
--- a/src/core/dbus.c
|
||||
+++ b/src/core/dbus.c
|
||||
@@ -908,8 +908,8 @@ int bus_init_api(Manager *m) {
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to set up API bus: %m");
|
||||
|
||||
- (void) bus_track_coldplug(bus, &m->subscribed, /* recursive= */ false, m->deserialized_subscribed);
|
||||
- m->deserialized_subscribed = strv_free(m->deserialized_subscribed);
|
||||
+ (void) bus_track_coldplug(bus, &m->subscribed, /* recursive= */ false, m->subscribed_as_strv);
|
||||
+ m->subscribed_as_strv = strv_free(m->subscribed_as_strv);
|
||||
m->api_bus = TAKE_PTR(bus);
|
||||
|
||||
r = manager_enqueue_sync_bus_names(m);
|
||||
@@ -1079,7 +1079,7 @@ static void destroy_bus(Manager *m, sd_bus **bus) {
|
||||
r = bus_track_to_strv(m->subscribed, &subscribed);
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Failed to serialize api subscribers, ignoring: %m");
|
||||
- strv_free_and_replace(m->deserialized_subscribed, subscribed);
|
||||
+ strv_free_and_replace(m->subscribed_as_strv, subscribed);
|
||||
|
||||
m->subscribed = sd_bus_track_unref(m->subscribed);
|
||||
}
|
||||
diff --git a/src/core/manager.c b/src/core/manager.c
|
||||
index c5d906e42e..37bdac8b1d 100644
|
||||
--- a/src/core/manager.c
|
||||
+++ b/src/core/manager.c
|
||||
@@ -1349,7 +1349,7 @@ Manager* manager_free(Manager *m) {
|
||||
free(m->switch_root_init);
|
||||
|
||||
sd_bus_track_unref(m->subscribed);
|
||||
- strv_free(m->deserialized_subscribed);
|
||||
+ strv_free(m->subscribed_as_strv);
|
||||
|
||||
rlimit_free_all(m->rlimit);
|
||||
|
||||
@@ -1659,8 +1659,8 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
|
||||
manager_setup_bus(m);
|
||||
|
||||
/* Now that we are connected to all possible busses, let's deserialize who is tracking us. */
|
||||
- (void) bus_track_coldplug(m->api_bus, &m->subscribed, false, m->deserialized_subscribed);
|
||||
- m->deserialized_subscribed = strv_free(m->deserialized_subscribed);
|
||||
+ (void) bus_track_coldplug(m->api_bus, &m->subscribed, false, m->subscribed_as_strv);
|
||||
+ m->subscribed_as_strv = strv_free(m->subscribed_as_strv);
|
||||
|
||||
/* Third, fire things up! */
|
||||
manager_coldplug(m);
|
||||
@@ -3382,7 +3382,7 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
|
||||
exec_runtime_deserialize_one(m, val, fds);
|
||||
else if ((val = startswith(l, "subscribed="))) {
|
||||
|
||||
- if (strv_extend(&m->deserialized_subscribed, val) < 0)
|
||||
+ if (strv_extend(&m->subscribed_as_strv, val) < 0)
|
||||
log_oom();
|
||||
} else {
|
||||
ManagerTimestamp q;
|
||||
diff --git a/src/core/manager.h b/src/core/manager.h
|
||||
index 98d381bc5b..e713250238 100644
|
||||
--- a/src/core/manager.h
|
||||
+++ b/src/core/manager.h
|
||||
@@ -215,7 +215,7 @@ struct Manager {
|
||||
considered subscribes, since they last for very short only,
|
||||
and it is much simpler that way. */
|
||||
sd_bus_track *subscribed;
|
||||
- char **deserialized_subscribed;
|
||||
+ char **subscribed_as_strv;
|
||||
|
||||
/* This is used during reloading: before the reload we queue
|
||||
* the reply message here, and afterwards we send it */
|
||||
@ -0,0 +1,55 @@
|
||||
From 42126f36367c4bcb39e37ba251ffbc1f04c9092b Mon Sep 17 00:00:00 2001
|
||||
From: Mike Yuan <me@yhndnzj.com>
|
||||
Date: Fri, 18 Jul 2025 15:13:03 +0200
|
||||
Subject: [PATCH] bus-util: do not reset the count returned by
|
||||
sd_bus_track_count_name()
|
||||
|
||||
Follow-up for 8402ca04d1a063c3d8a9e3d5c16df8bb8778ae98
|
||||
|
||||
While at it, turn the retval check for sd_bus_track_count_name()
|
||||
into assertion, given we're working with already established tracks
|
||||
(service_name_is_valid() should never yield false in this case).
|
||||
|
||||
Addresses https://github.com/systemd/systemd/pull/35406#discussion_r1912066774
|
||||
|
||||
(cherry picked from commit 33eeea4128f31df7ab4bd8866b582062d70114ae)
|
||||
|
||||
Related: RHEL-75081
|
||||
---
|
||||
src/shared/bus-util.c | 11 +++++------
|
||||
1 file changed, 5 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
|
||||
index 5ce4613262..ccce078902 100644
|
||||
--- a/src/shared/bus-util.c
|
||||
+++ b/src/shared/bus-util.c
|
||||
@@ -1696,16 +1696,15 @@ int bus_track_add_name_many(sd_bus_track *t, char **l) {
|
||||
|
||||
int bus_track_to_strv(sd_bus_track *t, char ***ret) {
|
||||
_cleanup_strv_free_ char **subscribed = NULL;
|
||||
- int r = 0;
|
||||
+ int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
for (const char *n = sd_bus_track_first(t); n; n = sd_bus_track_next(t)) {
|
||||
- r = sd_bus_track_count_name(t, n);
|
||||
- if (r < 0)
|
||||
- return r;
|
||||
+ int c = sd_bus_track_count_name(t, n);
|
||||
+ assert(c >= 0);
|
||||
|
||||
- for (int j = 0; j < r; j++) {
|
||||
+ for (int j = 0; j < c; j++) {
|
||||
r = strv_extend(&subscribed, n);
|
||||
if (r < 0)
|
||||
return r;
|
||||
@@ -1713,7 +1712,7 @@ int bus_track_to_strv(sd_bus_track *t, char ***ret) {
|
||||
}
|
||||
|
||||
*ret = TAKE_PTR(subscribed);
|
||||
- return r;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
int bus_open_system_watch_bind_with_description(sd_bus **ret, const char *description) {
|
||||
@ -0,0 +1,78 @@
|
||||
From c322f6916c2a69d31d124b59a295297cd3ca492d Mon Sep 17 00:00:00 2001
|
||||
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
||||
Date: Sun, 29 Dec 2024 15:50:43 +0900
|
||||
Subject: [PATCH] core: do not disconnect from bus when failed to install
|
||||
signal match
|
||||
|
||||
If bus_add_match_full() is called without install callback and we failed
|
||||
to install the signal match e.g. by timeout, then add_match_callback()
|
||||
will disconnect from the bus.
|
||||
Let's use a custom install handler and handle failures gracefully.
|
||||
|
||||
This does not *solve* the root cause of issue #30573, but should improve
|
||||
the situation when the issue is triggered.
|
||||
|
||||
(cherry picked from commit db6b214f95aa42f9a9fa3d94a3c6492cc57b58fb)
|
||||
|
||||
Related: RHEL-75081
|
||||
---
|
||||
src/core/unit.c | 39 ++++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 38 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/core/unit.c b/src/core/unit.c
|
||||
index ac960ef0c8..aedc1d806f 100644
|
||||
--- a/src/core/unit.c
|
||||
+++ b/src/core/unit.c
|
||||
@@ -3115,6 +3115,43 @@ int unit_load_related_unit(Unit *u, const char *type, Unit **_found) {
|
||||
return r;
|
||||
}
|
||||
|
||||
+static int signal_name_owner_changed_install_handler(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
+ Unit *u = userdata;
|
||||
+ const sd_bus_error *e;
|
||||
+ int r;
|
||||
+
|
||||
+ assert(message);
|
||||
+ assert(u);
|
||||
+
|
||||
+ e = sd_bus_message_get_error(message);
|
||||
+ if (!e) {
|
||||
+ log_unit_debug(u, "Successfully installed NameOwnerChanged signal match.");
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ r = sd_bus_error_get_errno(e);
|
||||
+ log_unit_error_errno(u, r,
|
||||
+ "Unexpected error response on installing NameOwnerChanged signal match: %s",
|
||||
+ bus_error_message(e, r));
|
||||
+
|
||||
+ /* If we failed to install NameOwnerChanged signal, also unref the bus slot of GetNameOwner(). */
|
||||
+ u->match_bus_slot = sd_bus_slot_unref(u->match_bus_slot);
|
||||
+
|
||||
+ if (UNIT_VTABLE(u)->bus_name_owner_change) {
|
||||
+ /* HACK: I'd like to avoid backporting fc67a943d9 so I have to deal with former
|
||||
+ vtable->bus_name_owner_change() signature, i.e. provide either old_owner or new_owner and bus_name.
|
||||
+ Also, vtable->bus_name_owner_change() is implemented only for services. */
|
||||
+ Service *s = SERVICE(u);
|
||||
+
|
||||
+ assert(u->type == UNIT_SERVICE);
|
||||
+
|
||||
+ if (s->bus_name_good)
|
||||
+ UNIT_VTABLE(u)->bus_name_owner_change(u, s->bus_name, s->bus_name_owner, NULL);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int signal_name_owner_changed(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
const char *name, *old_owner, *new_owner;
|
||||
Unit *u = userdata;
|
||||
@@ -3155,7 +3192,7 @@ int unit_install_bus_match(Unit *u, sd_bus *bus, const char *name) {
|
||||
"member='NameOwnerChanged',"
|
||||
"arg0='", name, "'");
|
||||
|
||||
- return sd_bus_add_match_async(bus, &u->match_bus_slot, match, signal_name_owner_changed, NULL, u);
|
||||
+ return sd_bus_add_match_async(bus, &u->match_bus_slot, match, signal_name_owner_changed, signal_name_owner_changed_install_handler, u);
|
||||
}
|
||||
|
||||
int unit_watch_bus_name(Unit *u, const char *name) {
|
||||
@ -0,0 +1,99 @@
|
||||
From fd3ab2173da5a35660565c289675c9961be28c16 Mon Sep 17 00:00:00 2001
|
||||
From: Michal Sekletar <msekleta@redhat.com>
|
||||
Date: Thu, 31 Jul 2025 18:26:09 +0200
|
||||
Subject: [PATCH] sd-bus/bus-track: use install_callback in
|
||||
sd_bus_track_add_name()
|
||||
|
||||
Previously we didn't provide any install_callback to
|
||||
sd_bus_add_match_async() so in case AddMatch() method call timed out we
|
||||
destroyed the bus connection. This seems overly aggressive and simply
|
||||
updating the sd_bus_track object accordingly should be enough.
|
||||
|
||||
Follow-up for 37ce3fd2b7dd8f81f6f4bca2003961a92b2963dc.
|
||||
|
||||
Fixes #32381
|
||||
|
||||
(cherry picked from commit dcf42d1ee21222ee698e5e0ab3ecf3411b63da40)
|
||||
|
||||
Related: RHEL-75081
|
||||
---
|
||||
src/libsystemd/sd-bus/bus-track.c | 30 ++++++++++++++++++++++++++----
|
||||
1 file changed, 26 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/libsystemd/sd-bus/bus-track.c b/src/libsystemd/sd-bus/bus-track.c
|
||||
index b818e93bec..7bb92a507b 100644
|
||||
--- a/src/libsystemd/sd-bus/bus-track.c
|
||||
+++ b/src/libsystemd/sd-bus/bus-track.c
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "sd-bus.h"
|
||||
|
||||
#include "alloc-util.h"
|
||||
+#include "bus-error.h"
|
||||
#include "bus-internal.h"
|
||||
#include "bus-track.h"
|
||||
#include "bus-util.h"
|
||||
@@ -13,6 +14,7 @@ struct track_item {
|
||||
unsigned n_ref;
|
||||
char *name;
|
||||
sd_bus_slot *slot;
|
||||
+ sd_bus_track *track;
|
||||
};
|
||||
|
||||
struct sd_bus_track {
|
||||
@@ -181,18 +183,37 @@ _public_ sd_bus_track* sd_bus_track_unref(sd_bus_track *track) {
|
||||
}
|
||||
|
||||
static int on_name_owner_changed(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
- sd_bus_track *track = userdata;
|
||||
+ struct track_item *item = userdata;
|
||||
const char *name;
|
||||
int r;
|
||||
|
||||
assert(message);
|
||||
- assert(track);
|
||||
+ assert(item->track);
|
||||
|
||||
r = sd_bus_message_read(message, "sss", &name, NULL, NULL);
|
||||
if (r < 0)
|
||||
return 0;
|
||||
|
||||
- bus_track_remove_name_fully(track, name);
|
||||
+ bus_track_remove_name_fully(item->track, name);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int name_owner_changed_install_callback(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) {
|
||||
+ struct track_item *item = userdata;
|
||||
+ const sd_bus_error *e;
|
||||
+
|
||||
+ assert(userdata);
|
||||
+ assert(message);
|
||||
+ assert(item->track);
|
||||
+ assert(item->name);
|
||||
+
|
||||
+ e = sd_bus_message_get_error(message);
|
||||
+ if (!e)
|
||||
+ return 0;
|
||||
+
|
||||
+ log_debug_errno(sd_bus_error_get_errno(e), "Failed to install match for tracking name '%s': %s", item->name, e->message);
|
||||
+
|
||||
+ bus_track_remove_name_fully(item->track, item->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -234,13 +255,14 @@ _public_ int sd_bus_track_add_name(sd_bus_track *track, const char *name) {
|
||||
n->name = strdup(name);
|
||||
if (!n->name)
|
||||
return -ENOMEM;
|
||||
+ n->track = track;
|
||||
|
||||
/* First, subscribe to this name */
|
||||
match = MATCH_FOR_NAME(name);
|
||||
|
||||
bus_track_remove_from_queue(track); /* don't dispatch this while we work in it */
|
||||
|
||||
- r = sd_bus_add_match_async(track->bus, &n->slot, match, on_name_owner_changed, NULL, track);
|
||||
+ r = sd_bus_add_match_async(track->bus, &n->slot, match, on_name_owner_changed, name_owner_changed_install_callback, n);
|
||||
if (r < 0) {
|
||||
bus_track_add_to_queue(track);
|
||||
return r;
|
||||
@ -0,0 +1,31 @@
|
||||
From f51c9ff5bd879c5cd1a7872fbd97cc2c447c19a0 Mon Sep 17 00:00:00 2001
|
||||
From: Mike Yuan <me@yhndnzj.com>
|
||||
Date: Mon, 13 Jan 2025 17:30:51 +0100
|
||||
Subject: [PATCH] core/manager: restore bus track deserialization cleanup in
|
||||
manager_reload()
|
||||
|
||||
There's zero explanation why it got (spuriously) removed in
|
||||
8402ca04d1a063c3d8a9e3d5c16df8bb8778ae98...
|
||||
|
||||
(cherry picked from commit 34f4b817f67b002eae7e2c09b19bf4b66c4791b6)
|
||||
|
||||
Related: RHEL-75081
|
||||
---
|
||||
src/core/manager.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/core/manager.c b/src/core/manager.c
|
||||
index 37bdac8b1d..bee94fb80d 100644
|
||||
--- a/src/core/manager.c
|
||||
+++ b/src/core/manager.c
|
||||
@@ -3542,6 +3542,10 @@ int manager_reload(Manager *m) {
|
||||
if (q < 0 && r >= 0)
|
||||
r = q;
|
||||
|
||||
+ /* Clean up deserialized bus track information. They're never consumed during reload (as opposed to
|
||||
+ * reexec) since we do not disconnect from the bus. */
|
||||
+ m->subscribed_as_strv = strv_free(m->subscribed_as_strv);
|
||||
+
|
||||
/* Third, fire things up! */
|
||||
manager_coldplug(m);
|
||||
|
||||
@ -0,0 +1,30 @@
|
||||
From ba370cdb895ee952a795e4934ef0b51fbbffe720 Mon Sep 17 00:00:00 2001
|
||||
From: Mike Yuan <me@yhndnzj.com>
|
||||
Date: Sat, 11 Jan 2025 18:38:49 +0100
|
||||
Subject: [PATCH] core/manager: drop duplicate bus track deserialization
|
||||
|
||||
bus_init_api() now does this internally
|
||||
(after 8402ca04d1a063c3d8a9e3d5c16df8bb8778ae98).
|
||||
|
||||
(cherry picked from commit af0e10354e567bfd0b9521376b2aad55f12a4e3d)
|
||||
|
||||
Related: RHEL-75081
|
||||
---
|
||||
src/core/manager.c | 4 ----
|
||||
1 file changed, 4 deletions(-)
|
||||
|
||||
diff --git a/src/core/manager.c b/src/core/manager.c
|
||||
index bee94fb80d..5212650fec 100644
|
||||
--- a/src/core/manager.c
|
||||
+++ b/src/core/manager.c
|
||||
@@ -1658,10 +1658,6 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
|
||||
/* Connect to the bus if we are good for it */
|
||||
manager_setup_bus(m);
|
||||
|
||||
- /* Now that we are connected to all possible busses, let's deserialize who is tracking us. */
|
||||
- (void) bus_track_coldplug(m->api_bus, &m->subscribed, false, m->subscribed_as_strv);
|
||||
- m->subscribed_as_strv = strv_free(m->subscribed_as_strv);
|
||||
-
|
||||
/* Third, fire things up! */
|
||||
manager_coldplug(m);
|
||||
|
||||
18
systemd.spec
18
systemd.spec
@ -13,7 +13,7 @@
|
||||
Name: systemd
|
||||
Url: http://www.freedesktop.org/wiki/Software/systemd
|
||||
Version: 239
|
||||
Release: 82%{?dist}.5
|
||||
Release: 82%{?dist}.6
|
||||
# For a breakdown of the licensing, see README
|
||||
License: LGPLv2+ and MIT and GPLv2+
|
||||
Summary: System and Service Manager
|
||||
@ -1075,6 +1075,13 @@ Patch1022: 1022-core-fix-member-access-within-null-pointer.patch
|
||||
Patch1023: 1023-man-be-even-clearer-that-tmpfiles-user-group-mode-ar.patch
|
||||
Patch1024: 1024-Revert-man-fix-description-of-force-in-halt-8-7392.patch
|
||||
Patch1025: 1025-man-explicitly-document-that-reboot-f-is-different-f.patch
|
||||
Patch1026: 1026-dbus-stash-the-subscriber-list-when-we-disconenct-fr.patch
|
||||
Patch1027: 1027-manager-s-deserialized_subscribed-subscribed_as_strv.patch
|
||||
Patch1028: 1028-bus-util-do-not-reset-the-count-returned-by-sd_bus_t.patch
|
||||
Patch1029: 1029-core-do-not-disconnect-from-bus-when-failed-to-insta.patch
|
||||
Patch1030: 1030-sd-bus-bus-track-use-install_callback-in-sd_bus_trac.patch
|
||||
Patch1031: 1031-core-manager-restore-bus-track-deserialization-clean.patch
|
||||
Patch1032: 1032-core-manager-drop-duplicate-bus-track-deserializatio.patch
|
||||
|
||||
%ifarch %{ix86} x86_64 aarch64
|
||||
%global have_gnu_efi 1
|
||||
@ -1701,6 +1708,15 @@ fi
|
||||
%files tests -f .file-list-tests
|
||||
|
||||
%changelog
|
||||
* Mon Aug 25 2025 systemd maintenance team <systemd-maint@redhat.com> - 239-82.6
|
||||
- dbus: stash the subscriber list when we disconenct from the bus (RHEL-75081)
|
||||
- manager: s/deserialized_subscribed/subscribed_as_strv (RHEL-75081)
|
||||
- bus-util: do not reset the count returned by sd_bus_track_count_name() (RHEL-75081)
|
||||
- core: do not disconnect from bus when failed to install signal match (RHEL-75081)
|
||||
- sd-bus/bus-track: use install_callback in sd_bus_track_add_name() (RHEL-75081)
|
||||
- core/manager: restore bus track deserialization cleanup in manager_reload() (RHEL-75081)
|
||||
- core/manager: drop duplicate bus track deserialization (RHEL-75081)
|
||||
|
||||
* Wed Mar 05 2025 systemd maintenance team <systemd-maint@redhat.com> - 239-82.5
|
||||
- man: be even clearer that tmpfiles user/group/mode are applied on existing inodes (RHEL-77145)
|
||||
- Revert "man: fix description of --force in halt(8) (#7392)" (RHEL-81056)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user