]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/service: do not reset watchdong when unit is frozen
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 16 Aug 2025 16:00:37 +0000 (01:00 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 16 Aug 2025 20:19:26 +0000 (05:19 +0900)
Even watchdog for a service is stopped when freezing the unit is
requested, sd-notify message WATCHDOG=1 or friends may come after
that due to ordering of event priority. In that case,
service_reset_watchdog() is called for frozen unit and thus previously
watchdog was reenabled.

Follow-up for 25178aadb2bd04ef9e63f48c1ef42fb309f9332e.
Fixes #38551 (the second failure case).

src/core/service.c

index 4f8eaf405184a1a68ea5c022cab7d7d235b21d45..d94162ead0be5738fe1c04691b27bc9d5ebdd828 100644 (file)
@@ -414,6 +414,12 @@ static void service_extend_timeout(Service *s, usec_t extend_timeout_usec) {
 static void service_reset_watchdog(Service *s) {
         assert(s);
 
+        if (freezer_state_finish(UNIT(s)->freezer_state) != FREEZER_RUNNING) {
+                log_unit_debug(UNIT(s), "Service is currently %s, skipping resetting watchdog.",
+                               freezer_state_to_string(UNIT(s)->freezer_state));
+                return;
+        }
+
         dual_timestamp_now(&s->watchdog_timestamp);
         service_start_watchdog(s);
 }