systemd/1081-core-extend-comments-regarding-coldplug-vs.-catchup.patch
Jan Macku 8428f3bcad systemd-239-82.17
Resolves: RHEL-168671
2026-05-25 13:03:55 +02:00

37 lines
2.0 KiB
Diff

From dd0c1ce0eec10226da5789c43ba4b3f5305ea012 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 11 Dec 2018 15:22:10 +0100
Subject: [PATCH] core: extend comments regarding coldplug() vs. catchup()
(cherry picked from commit a95c0505ad89b77878ed05192fe91175cf42e8b5)
Related: RHEL-168671
---
src/core/unit.h | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/core/unit.h b/src/core/unit.h
index e2dd7949e5..914035d55c 100644
--- a/src/core/unit.h
+++ b/src/core/unit.h
@@ -446,11 +446,16 @@ typedef struct UnitVTable {
int (*load)(Unit *u);
/* During deserialization we only record the intended state to return to. With coldplug() we actually put the
- * deserialized state in effect. This is where unit_notify() should be called to start things up. */
+ * deserialized state in effect. This is where unit_notify() should be called to start things up. Note that
+ * this callback is invoked *before* we leave the reloading state of the manager, i.e. *before* we consider the
+ * reloading to be complete. Thus, this callback should just restore the exact same state for any unit that was
+ * in effect before the reload, i.e. units should not catch up with changes happened during the reload. That's
+ * what catchup() below is for. */
int (*coldplug)(Unit *u);
- /* This is called shortly after all units' coldplug() call was invoked. It's supposed to catch up state changes
- * we missed so far (for example because they took place while we were reloading/reexecing) */
+ /* This is called shortly after all units' coldplug() call was invoked, and *after* the manager left the
+ * reloading state. It's supposed to catch up with state changes due to external events we missed so far (for
+ * example because they took place while we were reloading/reexecing) */
void (*catchup)(Unit *u);
void (*dump)(Unit *u, FILE *f, const char *prefix);