]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
unit: coldplug both job and nop_job if possible
authorGeass-LL <shenxiaogll@163.com>
Fri, 2 Apr 2021 03:27:59 +0000 (11:27 +0800)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 16 Aug 2021 17:41:04 +0000 (02:41 +0900)
Sometimes, both job and nop_job are deserialized. In this case,
if we only cold plug the job, the nop_job will also stuck in the
job list.

src/core/unit.c

index 7c39e4d0f8c66ab314dd166ade8e546f2d3b5b0a..2f7f022ef35492cfb42e62b2f309d76126b5c8dc 100644 (file)
@@ -3588,7 +3588,6 @@ int unit_add_blockdev_dependency(Unit *u, const char *what, UnitDependencyMask m
 int unit_coldplug(Unit *u) {
         int r = 0, q;
         char **i;
-        Job *uj;
 
         assert(u);
 
@@ -3611,9 +3610,13 @@ int unit_coldplug(Unit *u) {
                         r = q;
         }
 
-        uj = u->job ?: u->nop_job;
-        if (uj) {
-                q = job_coldplug(uj);
+        if (u->job) {
+                q = job_coldplug(u->job);
+                if (q < 0 && r >= 0)
+                        r = q;
+        }
+        if (u->nop_job) {
+                q = job_coldplug(u->nop_job);
                 if (q < 0 && r >= 0)
                         r = q;
         }