chiark / gitweb /
transaction: change the linking of isolate jobs to the anchor
authorMichal Schmidt <mschmidt@redhat.com>
Fri, 20 Apr 2012 08:33:37 +0000 (10:33 +0200)
committerMichal Schmidt <mschmidt@redhat.com>
Fri, 20 Apr 2012 15:12:28 +0000 (17:12 +0200)
When isolating, the JOB_STOP jobs have no parent job, so they are all peers
of the real anchor job. This is a bit odd.

Link them from the anchor job.

src/core/transaction.c

index d7ecfdb44642f9d259f858a8c21cc86f53c004ab..09abe007fb43ea3acda56c1abce9ccb964553fd5 100644 (file)
@@ -893,8 +893,8 @@ int transaction_add_job_and_dependencies(
         /* If the link has no subject job, it's the anchor link. */
         if (!by) {
                 LIST_PREPEND(JobDependency, subject, tr->anchor, l);
-                if (!tr->anchor_job)
-                        tr->anchor_job = ret;
+                assert(!tr->anchor_job);
+                tr->anchor_job = ret;
         }
 
         if (is_new && !ignore_requirements) {
@@ -1077,7 +1077,7 @@ int transaction_add_isolate_jobs(Transaction *tr, Manager *m) {
                 if (hashmap_get(tr->jobs, u))
                         continue;
 
-                r = transaction_add_job_and_dependencies(tr, JOB_STOP, u, NULL, true, false, false, false, false, NULL);
+                r = transaction_add_job_and_dependencies(tr, JOB_STOP, u, tr->anchor_job, true, false, false, false, false, NULL);
                 if (r < 0)
                         log_warning("Cannot add isolate job for unit %s, ignoring: %s", u->id, strerror(-r));
         }