From 1f3b407307b998295e617de4c5bc477daebcc80d Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sat, 7 Feb 2026 01:07:33 +0900 Subject: [PATCH] daemon-util: downgrade log level on ECONNREFUSED and friends This partially reverts 36c557f7d41441bbd98a8965348dfe8050fc9c98, which introduced notify_remove_fd() that logs in LOG_DEBUG. However, notify_remove_fd_warn() is still called other library functions, e.g. notify_push_fd(), and produces warning message about the failure in removing fd from fdstore on shutdown. During shutdown process, we get the following logs: ``` systemd-udevd[370]: Failed to send notify message to '/run/systemd/notify': Connection refused systemd-udevd[370]: Failed to remove file descriptor "config-serialization" from the store, ignoring: Connection refused systemd-udevd[370]: Failed to send notify message to '/run/systemd/notify': Connection refused systemd-udevd[370]: Failed to push serialization fd to service manager: Connection refused ``` Here, the 1st, 3rd, and 4th messages are in LOG_DEBUG, but the 2nd one was in LOG_WARNING before this commit, and this makes it also in LOG_DEBUG. Follow-up for 472404aca5357b7e65cdddf418342070b0ccd4d2. --- src/shared/daemon-util.c | 13 +++---------- src/shared/daemon-util.h | 1 - src/udev/udev-manager.c | 2 +- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/shared/daemon-util.c b/src/shared/daemon-util.c index dbd0de6567f..321a9e58daf 100644 --- a/src/shared/daemon-util.c +++ b/src/shared/daemon-util.c @@ -4,12 +4,13 @@ #include "alloc-util.h" #include "daemon-util.h" +#include "errno-util.h" #include "fd-util.h" #include "log.h" #include "string-util.h" #include "time-util.h" -static int notify_remove_fd_full(int log_level, const char *name) { +int notify_remove_fd_warn(const char *name) { int r; assert(name); @@ -19,21 +20,13 @@ static int notify_remove_fd_full(int log_level, const char *name) { "FDNAME=%s", name); if (r < 0) return log_full_errno( - log_level, r, + ERRNO_IS_NEG_DISCONNECT(r) ? LOG_DEBUG : LOG_WARNING, 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; diff --git a/src/shared/daemon-util.h b/src/shared/daemon-util.h index d0252a8c82f..708a32985c6 100644 --- a/src/shared/daemon-util.h +++ b/src/shared/daemon-util.h @@ -21,7 +21,6 @@ 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); diff --git a/src/udev/udev-manager.c b/src/udev/udev-manager.c index a38f61c0a20..46c8a85d986 100644 --- a/src/udev/udev-manager.c +++ b/src/udev/udev-manager.c @@ -1529,7 +1529,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("event-serialization"); + (void) notify_remove_fd_warn("event-serialization"); r = sd_event_loop(manager->event); if (r < 0) -- 2.47.3