udev: silence notification failures (#40275)

Closes #39943.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2026-01-14 16:26:00 +01:00
committed by GitHub
4 changed files with 17 additions and 6 deletions
+13 -4
View File
@@ -9,7 +9,7 @@
#include "string-util.h"
#include "time-util.h"
int notify_remove_fd_warn(const char *name) {
static int notify_remove_fd_full(int log_level, const char *name) {
int r;
assert(name);
@@ -18,13 +18,22 @@ int notify_remove_fd_warn(const char *name) {
"FDSTOREREMOVE=1\n"
"FDNAME=%s", name);
if (r < 0)
return log_warning_errno(r,
"Failed to remove file descriptor \"%s\" from the store, ignoring: %m",
name);
return log_full_errno(
log_level, r,
"Failed to remove file descriptor \"%s\" from the store, ignoring: %m",
name);
return 0;
}
int notify_remove_fd(const char *name) {
return notify_remove_fd_full(LOG_DEBUG, name);
}
int notify_remove_fd_warn(const char *name) {
return notify_remove_fd_full(LOG_WARNING, name);
}
int notify_remove_fd_warnf(const char *format, ...) {
_cleanup_free_ char *p = NULL;
va_list ap;
+1
View File
@@ -21,6 +21,7 @@ static inline void notify_on_cleanup(const char **p) {
(void) sd_notify(false, *p);
}
int notify_remove_fd(const char *name);
int notify_remove_fd_warn(const char *name);
int notify_remove_fd_warnf(const char *format, ...) _printf_(1, 2);
int close_and_notify_warn(int fd, const char *name);
+2 -1
View File
@@ -557,9 +557,10 @@ int manager_serialize_config(Manager *manager) {
if (r < 0)
return log_warning_errno(r, "Failed to finalize serialization file: %m");
/* This may fail on shutdown/reboot. Let's not warn louder. */
r = notify_push_fd(fileno(f), "config-serialization");
if (r < 0)
return log_warning_errno(r, "Failed to push serialization fd to service manager: %m");
return log_debug_errno(r, "Failed to push serialization fd to service manager: %m");
log_debug("Serialized configurations.");
return 0;
+1 -1
View File
@@ -1503,7 +1503,7 @@ int manager_main(Manager *manager) {
/* We will start processing events in the loop below. Before starting processing, let's remove the
* event serialization fd from the fdstore, to avoid retrieving the serialized events again in future
* invocations. Otherwise, the serialized events may be processed multiple times. */
(void) notify_remove_fd_warn("event-serialization");
(void) notify_remove_fd("event-serialization");
r = sd_event_loop(manager->event);
if (r < 0)