]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
daemon-util: downgrade log level on ECONNREFUSED and friends
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 6 Feb 2026 16:07:33 +0000 (01:07 +0900)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 6 Feb 2026 23:15:33 +0000 (00:15 +0100)
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
src/shared/daemon-util.h
src/udev/udev-manager.c

index dbd0de6567f0f30bc9e2aa8777e0c30e6e9552ba..321a9e58dafc37ed8f4d87e4e78dcdbed487369b 100644 (file)
@@ -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;
index d0252a8c82f62abd820cf6a723185631a5616f86..708a32985c6c521a521890560cbc11ca806a6322 100644 (file)
@@ -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);
index a38f61c0a2080fcef709d27a208b2c7b8aeda1f1..46c8a85d98608d03bbd2612df08d29a769008705 100644 (file)
@@ -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)