]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
machined: downgrade warning if we cannot drop ref to systemd unit if disconnected...
authorLennart Poettering <lennart@poettering.net>
Mon, 27 May 2024 17:06:08 +0000 (19:06 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Tue, 28 May 2024 13:05:11 +0000 (15:05 +0200)
if machined exits while a machine is still running, we'll issue the
UnrefUnit() call on the unit. This quite likely will fail if during
shutdown the bus connection is already down. But that's no reason to
warn at all, since the ref count will implicitly be dropped if our side
disappears from the bus. Hence, downgrade to LOG_DEBUG in case of
connection problems.

src/machine/machine.c

index 5c21a039e5e351990b13e095f06e498b61bb2327..0eb9a55e5f74dde6cd34dbecec1fa99f09e46808 100644 (file)
@@ -675,8 +675,9 @@ void machine_release_unit(Machine *m) {
 
                 r = manager_unref_unit(m->manager, m->unit, &error);
                 if (r < 0)
-                        log_warning_errno(r, "Failed to drop reference to machine scope, ignoring: %s",
-                                          bus_error_message(&error, r));
+                        log_full_errno(ERRNO_IS_DISCONNECT(r) ? LOG_DEBUG : LOG_WARNING, r,
+                                       "Failed to drop reference to machine scope, ignoring: %s",
+                                       bus_error_message(&error, r));
 
                 m->referenced = false;
         }