]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/unit: put the reload job back to queue if unit is refreshing
authorMike Yuan <me@yhndnzj.com>
Wed, 16 Oct 2024 16:59:45 +0000 (18:59 +0200)
committerMike Yuan <me@yhndnzj.com>
Tue, 22 Oct 2024 17:19:46 +0000 (19:19 +0200)
src/core/unit.c

index 4384e3bfcbf2830a3c4c2fc7e83c80d36baf32af..230a782631af733c1d1dbf89fd17fe09cebbbf0b 100644 (file)
@@ -2044,7 +2044,11 @@ int unit_reload(Unit *u) {
                 return -EBADR;
 
         state = unit_active_state(u);
-        if (state == UNIT_RELOADING)
+        if (IN_SET(state, UNIT_RELOADING, UNIT_REFRESHING))
+                /* "refreshing" means some resources in the unit namespace is being updated. Unlike reload,
+                 * the unit processes aren't made aware of refresh. Let's put the job back to queue
+                 * in both cases, as refresh typically takes place before reload and it's better to wait
+                 * for it rather than failing. */
                 return -EAGAIN;
 
         if (state != UNIT_ACTIVE)