1 #include "transaction.h"
2 #include "bus-errors.h"
4 static void transaction_unlink_job(Transaction *tr, Job *j, bool delete_dependencies);
6 static void transaction_delete_job(Transaction *tr, Job *j, bool delete_dependencies) {
10 /* Deletes one job from the transaction */
12 transaction_unlink_job(tr, j, delete_dependencies);
18 static void transaction_delete_unit(Transaction *tr, Unit *u) {
21 /* Deletes all jobs associated with a certain unit from the
24 while ((j = hashmap_get(tr->jobs, u)))
25 transaction_delete_job(tr, j, true);
28 void transaction_abort(Transaction *tr) {
33 while ((j = hashmap_first(tr->jobs)))
34 transaction_delete_job(tr, j, true);
36 assert(hashmap_isempty(tr->jobs));
41 static void transaction_find_jobs_that_matter_to_anchor(Job *j, unsigned generation) {
44 /* A recursive sweep through the graph that marks all units
45 * that matter to the anchor job, i.e. are directly or
46 * indirectly a dependency of the anchor job via paths that
47 * are fully marked as mattering. */
49 j->matters_to_anchor = true;
50 j->generation = generation;
52 LIST_FOREACH(subject, l, j->subject_list) {
54 /* This link does not matter */
58 /* This unit has already been marked */
59 if (l->object->generation == generation)
62 transaction_find_jobs_that_matter_to_anchor(l->object, generation);
66 static void transaction_merge_and_delete_job(Transaction *tr, Job *j, Job *other, JobType t) {
67 JobDependency *l, *last;
71 assert(j->unit == other->unit);
72 assert(!j->installed);
74 /* Merges 'other' into 'j' and then deletes 'other'. */
77 j->state = JOB_WAITING;
78 j->override = j->override || other->override;
80 j->matters_to_anchor = j->matters_to_anchor || other->matters_to_anchor;
82 /* Patch us in as new owner of the JobDependency objects */
84 LIST_FOREACH(subject, l, other->subject_list) {
85 assert(l->subject == other);
90 /* Merge both lists */
92 last->subject_next = j->subject_list;
94 j->subject_list->subject_prev = last;
95 j->subject_list = other->subject_list;
98 /* Patch us in as new owner of the JobDependency objects */
100 LIST_FOREACH(object, l, other->object_list) {
101 assert(l->object == other);
106 /* Merge both lists */
108 last->object_next = j->object_list;
110 j->object_list->object_prev = last;
111 j->object_list = other->object_list;
114 /* Kill the other job */
115 other->subject_list = NULL;
116 other->object_list = NULL;
117 transaction_delete_job(tr, other, true);
120 static bool job_is_conflicted_by(Job *j) {
125 /* Returns true if this job is pulled in by a least one
126 * ConflictedBy dependency. */
128 LIST_FOREACH(object, l, j->object_list)
135 static int delete_one_unmergeable_job(Transaction *tr, Job *j) {
140 /* Tries to delete one item in the linked list
141 * j->transaction_next->transaction_next->... that conflicts
142 * with another one, in an attempt to make an inconsistent
143 * transaction work. */
145 /* We rely here on the fact that if a merged with b does not
146 * merge with c, either a or b merge with c neither */
147 LIST_FOREACH(transaction, j, j)
148 LIST_FOREACH(transaction, k, j->transaction_next) {
151 /* Is this one mergeable? Then skip it */
152 if (job_type_is_mergeable(j->type, k->type))
155 /* Ok, we found two that conflict, let's see if we can
156 * drop one of them */
157 if (!j->matters_to_anchor && !k->matters_to_anchor) {
159 /* Both jobs don't matter, so let's
160 * find the one that is smarter to
161 * remove. Let's think positive and
162 * rather remove stops then starts --
163 * except if something is being
164 * stopped because it is conflicted by
165 * another unit in which case we
166 * rather remove the start. */
168 log_debug("Looking at job %s/%s conflicted_by=%s", j->unit->id, job_type_to_string(j->type), yes_no(j->type == JOB_STOP && job_is_conflicted_by(j)));
169 log_debug("Looking at job %s/%s conflicted_by=%s", k->unit->id, job_type_to_string(k->type), yes_no(k->type == JOB_STOP && job_is_conflicted_by(k)));
171 if (j->type == JOB_STOP) {
173 if (job_is_conflicted_by(j))
178 } else if (k->type == JOB_STOP) {
180 if (job_is_conflicted_by(k))
187 } else if (!j->matters_to_anchor)
189 else if (!k->matters_to_anchor)
194 /* Ok, we can drop one, so let's do so. */
195 log_debug("Fixing conflicting jobs by deleting job %s/%s", d->unit->id, job_type_to_string(d->type));
196 transaction_delete_job(tr, d, true);
203 static int transaction_merge_jobs(Transaction *tr, DBusError *e) {
210 /* First step, check whether any of the jobs for one specific
211 * task conflict. If so, try to drop one of them. */
212 HASHMAP_FOREACH(j, tr->jobs, i) {
217 LIST_FOREACH(transaction, k, j->transaction_next) {
218 if (job_type_merge(&t, k->type) >= 0)
221 /* OK, we could not merge all jobs for this
222 * action. Let's see if we can get rid of one
225 r = delete_one_unmergeable_job(tr, j);
227 /* Ok, we managed to drop one, now
228 * let's ask our callers to call us
229 * again after garbage collecting */
232 /* We couldn't merge anything. Failure */
233 dbus_set_error(e, BUS_ERROR_TRANSACTION_JOBS_CONFLICTING, "Transaction contains conflicting jobs '%s' and '%s' for %s. Probably contradicting requirement dependencies configured.",
234 job_type_to_string(t), job_type_to_string(k->type), k->unit->id);
239 /* Second step, merge the jobs. */
240 HASHMAP_FOREACH(j, tr->jobs, i) {
244 /* Merge all transactions */
245 LIST_FOREACH(transaction, k, j->transaction_next)
246 assert_se(job_type_merge(&t, k->type) == 0);
248 /* If an active job is mergeable, merge it too */
250 job_type_merge(&t, j->unit->job->type); /* Might fail. Which is OK */
252 while ((k = j->transaction_next)) {
254 transaction_merge_and_delete_job(tr, k, j, t);
257 transaction_merge_and_delete_job(tr, j, k, t);
260 if (j->unit->job && !j->installed)
261 transaction_merge_and_delete_job(tr, j, j->unit->job, t);
263 assert(!j->transaction_next);
264 assert(!j->transaction_prev);
270 static void transaction_drop_redundant(Transaction *tr) {
275 /* Goes through the transaction and removes all jobs that are
284 HASHMAP_FOREACH(j, tr->jobs, i) {
285 bool changes_something = false;
288 LIST_FOREACH(transaction, k, j) {
290 if (!job_is_anchor(k) &&
291 (k->installed || job_type_is_redundant(k->type, unit_active_state(k->unit))) &&
292 (!k->unit->job || !job_type_is_conflicting(k->type, k->unit->job->type)))
295 changes_something = true;
299 if (changes_something)
302 /* log_debug("Found redundant job %s/%s, dropping.", j->unit->id, job_type_to_string(j->type)); */
303 transaction_delete_job(tr, j, false);
311 static bool unit_matters_to_anchor(Unit *u, Job *j) {
313 assert(!j->transaction_prev);
315 /* Checks whether at least one of the jobs for this unit
316 * matters to the anchor. */
318 LIST_FOREACH(transaction, j, j)
319 if (j->matters_to_anchor)
325 static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsigned generation, DBusError *e) {
332 assert(!j->transaction_prev);
334 /* Does a recursive sweep through the ordering graph, looking
335 * for a cycle. If we find cycle we try to break it. */
337 /* Have we seen this before? */
338 if (j->generation == generation) {
341 /* If the marker is NULL we have been here already and
342 * decided the job was loop-free from here. Hence
343 * shortcut things and return right-away. */
347 /* So, the marker is not NULL and we already have been
348 * here. We have a cycle. Let's try to break it. We go
349 * backwards in our path and try to find a suitable
350 * job to remove. We use the marker to find our way
351 * back, since smart how we are we stored our way back
353 log_warning("Found ordering cycle on %s/%s", j->unit->id, job_type_to_string(j->type));
356 for (k = from; k; k = ((k->generation == generation && k->marker != k) ? k->marker : NULL)) {
358 log_info("Walked on cycle path to %s/%s", k->unit->id, job_type_to_string(k->type));
362 !unit_matters_to_anchor(k->unit, k)) {
363 /* Ok, we can drop this one, so let's
368 /* Check if this in fact was the beginning of
376 log_warning("Breaking ordering cycle by deleting job %s/%s", delete->unit->id, job_type_to_string(delete->type));
377 transaction_delete_unit(tr, delete->unit);
381 log_error("Unable to break cycle");
383 dbus_set_error(e, BUS_ERROR_TRANSACTION_ORDER_IS_CYCLIC, "Transaction order is cyclic. See system logs for details.");
387 /* Make the marker point to where we come from, so that we can
388 * find our way backwards if we want to break a cycle. We use
389 * a special marker for the beginning: we point to
391 j->marker = from ? from : j;
392 j->generation = generation;
394 /* We assume that the the dependencies are bidirectional, and
395 * hence can ignore UNIT_AFTER */
396 SET_FOREACH(u, j->unit->dependencies[UNIT_BEFORE], i) {
399 /* Is there a job for this unit? */
400 o = hashmap_get(tr->jobs, u);
402 /* Ok, there is no job for this in the
403 * transaction, but maybe there is already one
410 r = transaction_verify_order_one(tr, o, j, generation, e);
415 /* Ok, let's backtrack, and remember that this entry is not on
416 * our path anymore. */
422 static int transaction_verify_order(Transaction *tr, unsigned *generation, DBusError *e) {
431 /* Check if the ordering graph is cyclic. If it is, try to fix
432 * that up by dropping one of the jobs. */
436 HASHMAP_FOREACH(j, tr->jobs, i)
437 if ((r = transaction_verify_order_one(tr, j, NULL, g, e)) < 0)
443 static void transaction_collect_garbage(Transaction *tr) {
448 /* Drop jobs that are not required by any other job */
456 HASHMAP_FOREACH(j, tr->jobs, i) {
457 if (tr->anchor_job == j || j->object_list) {
458 /* log_debug("Keeping job %s/%s because of %s/%s", */
459 /* j->unit->id, job_type_to_string(j->type), */
460 /* j->object_list->subject ? j->object_list->subject->unit->id : "root", */
461 /* j->object_list->subject ? job_type_to_string(j->object_list->subject->type) : "root"); */
465 /* log_debug("Garbage collecting job %s/%s", j->unit->id, job_type_to_string(j->type)); */
466 transaction_delete_job(tr, j, true);
474 static int transaction_is_destructive(Transaction *tr, DBusError *e) {
480 /* Checks whether applying this transaction means that
481 * existing jobs would be replaced */
483 HASHMAP_FOREACH(j, tr->jobs, i) {
486 assert(!j->transaction_prev);
487 assert(!j->transaction_next);
491 !job_type_is_superset(j->type, j->unit->job->type)) {
493 dbus_set_error(e, BUS_ERROR_TRANSACTION_IS_DESTRUCTIVE, "Transaction is destructive.");
501 static void transaction_minimize_impact(Transaction *tr) {
505 /* Drops all unnecessary jobs that reverse already active jobs
506 * or that stop a running service. */
514 HASHMAP_FOREACH(j, tr->jobs, i) {
515 LIST_FOREACH(transaction, j, j) {
516 bool stops_running_service, changes_existing_job;
518 /* If it matters, we shouldn't drop it */
519 if (j->matters_to_anchor)
522 /* Would this stop a running service?
523 * Would this change an existing job?
524 * If so, let's drop this entry */
526 stops_running_service =
527 j->type == JOB_STOP && UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(j->unit));
529 changes_existing_job =
531 job_type_is_conflicting(j->type, j->unit->job->type);
533 if (!stops_running_service && !changes_existing_job)
536 if (stops_running_service)
537 log_debug("%s/%s would stop a running service.", j->unit->id, job_type_to_string(j->type));
539 if (changes_existing_job)
540 log_debug("%s/%s would change existing job.", j->unit->id, job_type_to_string(j->type));
542 /* Ok, let's get rid of this */
543 log_debug("Deleting %s/%s to minimize impact.", j->unit->id, job_type_to_string(j->type));
545 transaction_delete_job(tr, j, true);
557 static int transaction_apply(Transaction *tr, Manager *m, JobMode mode) {
562 /* Moves the transaction jobs to the set of active jobs */
564 if (mode == JOB_ISOLATE) {
566 /* When isolating first kill all installed jobs which
567 * aren't part of the new transaction */
569 HASHMAP_FOREACH(j, m->jobs, i) {
570 assert(j->installed);
572 if (hashmap_get(tr->jobs, j->unit))
575 /* 'j' itself is safe to remove, but if other jobs
576 are invalidated recursively, our iterator may become
577 invalid and we need to start over. */
578 if (job_finish_and_invalidate(j, JOB_CANCELED) > 0)
583 HASHMAP_FOREACH(j, tr->jobs, i) {
585 assert(!j->transaction_prev);
586 assert(!j->transaction_next);
591 r = hashmap_put(m->jobs, UINT32_TO_PTR(j->id), j);
596 while ((j = hashmap_steal_first(tr->jobs))) {
599 /* log_debug("Skipping already installed job %s/%s as %u", j->unit->id, job_type_to_string(j->type), (unsigned) j->id); */
611 m->n_installed_jobs ++;
613 /* We're fully installed. Now let's free data we don't
616 assert(!j->transaction_next);
617 assert(!j->transaction_prev);
619 /* Clean the job dependencies */
620 transaction_unlink_job(tr, j, false);
622 job_add_to_run_queue(j);
623 job_add_to_dbus_queue(j);
626 log_debug("Installed new job %s/%s as %u", j->unit->id, job_type_to_string(j->type), (unsigned) j->id);
635 HASHMAP_FOREACH(j, tr->jobs, i) {
639 hashmap_remove(m->jobs, UINT32_TO_PTR(j->id));
645 int transaction_activate(Transaction *tr, Manager *m, JobMode mode, DBusError *e) {
647 unsigned generation = 1;
651 /* This applies the changes recorded in tr->jobs to
652 * the actual list of jobs, if possible. */
654 /* First step: figure out which jobs matter */
655 transaction_find_jobs_that_matter_to_anchor(tr->anchor_job, generation++);
657 /* Second step: Try not to stop any running services if
658 * we don't have to. Don't try to reverse running
659 * jobs if we don't have to. */
660 if (mode == JOB_FAIL)
661 transaction_minimize_impact(tr);
663 /* Third step: Drop redundant jobs */
664 transaction_drop_redundant(tr);
667 /* Fourth step: Let's remove unneeded jobs that might
669 if (mode != JOB_ISOLATE)
670 transaction_collect_garbage(tr);
672 /* Fifth step: verify order makes sense and correct
673 * cycles if necessary and possible */
674 r = transaction_verify_order(tr, &generation, e);
679 log_warning("Requested transaction contains an unfixable cyclic ordering dependency: %s", bus_error(e, r));
683 /* Let's see if the resulting transaction ordering
684 * graph is still cyclic... */
688 /* Sixth step: let's drop unmergeable entries if
689 * necessary and possible, merge entries we can
691 r = transaction_merge_jobs(tr, e);
696 log_warning("Requested transaction contains unmergeable jobs: %s", bus_error(e, r));
700 /* Seventh step: an entry got dropped, let's garbage
701 * collect its dependencies. */
702 if (mode != JOB_ISOLATE)
703 transaction_collect_garbage(tr);
705 /* Let's see if the resulting transaction still has
706 * unmergeable entries ... */
709 /* Eights step: Drop redundant jobs again, if the merging now allows us to drop more. */
710 transaction_drop_redundant(tr);
712 /* Ninth step: check whether we can actually apply this */
713 if (mode == JOB_FAIL) {
714 r = transaction_is_destructive(tr, e);
716 log_notice("Requested transaction contradicts existing jobs: %s", bus_error(e, r));
721 /* Tenth step: apply changes */
722 r = transaction_apply(tr, m, mode);
724 log_warning("Failed to apply transaction: %s", strerror(-r));
728 assert(hashmap_isempty(tr->jobs));
734 static Job* transaction_add_one_job(Transaction *tr, JobType type, Unit *unit, bool override, bool *is_new) {
740 /* Looks for an existing prospective job and returns that. If
741 * it doesn't exist it is created and added to the prospective
744 f = hashmap_get(tr->jobs, unit);
746 LIST_FOREACH(transaction, j, f) {
747 assert(j->unit == unit);
749 if (j->type == type) {
756 j = job_new(unit, type);
762 j->matters_to_anchor = false;
763 j->override = override;
765 LIST_PREPEND(Job, transaction, f, j);
767 if (hashmap_replace(tr->jobs, unit, f) < 0) {
768 LIST_REMOVE(Job, transaction, f, j);
776 /* log_debug("Added job %s/%s to transaction.", unit->id, job_type_to_string(type)); */
781 static void transaction_job_dependency_free(Transaction *tr, JobDependency *l) {
783 LIST_REMOVE(JobDependency, subject, tr->anchor, l);
784 job_dependency_free(l);
787 static void transaction_unlink_job(Transaction *tr, Job *j, bool delete_dependencies) {
791 if (j->transaction_prev)
792 j->transaction_prev->transaction_next = j->transaction_next;
793 else if (j->transaction_next)
794 hashmap_replace(tr->jobs, j->unit, j->transaction_next);
796 hashmap_remove_value(tr->jobs, j->unit, j);
798 if (j->transaction_next)
799 j->transaction_next->transaction_prev = j->transaction_prev;
801 j->transaction_prev = j->transaction_next = NULL;
803 while (j->subject_list)
804 transaction_job_dependency_free(tr, j->subject_list);
806 while (j->object_list) {
807 Job *other = j->object_list->matters ? j->object_list->subject : NULL;
809 transaction_job_dependency_free(tr, j->object_list);
811 if (other && delete_dependencies) {
812 log_debug("Deleting job %s/%s as dependency of job %s/%s",
813 other->unit->id, job_type_to_string(other->type),
814 j->unit->id, job_type_to_string(j->type));
815 transaction_delete_job(tr, other, delete_dependencies);
820 int transaction_add_job_and_dependencies(
828 bool ignore_requirements,
839 assert(type < _JOB_TYPE_MAX);
842 /* log_debug("Pulling in %s/%s from %s/%s", */
843 /* unit->id, job_type_to_string(type), */
844 /* by ? by->unit->id : "NA", */
845 /* by ? job_type_to_string(by->type) : "NA"); */
847 if (unit->load_state != UNIT_LOADED &&
848 unit->load_state != UNIT_ERROR &&
849 unit->load_state != UNIT_MASKED) {
850 dbus_set_error(e, BUS_ERROR_LOAD_FAILED, "Unit %s is not loaded properly.", unit->id);
854 if (type != JOB_STOP && unit->load_state == UNIT_ERROR) {
855 dbus_set_error(e, BUS_ERROR_LOAD_FAILED,
856 "Unit %s failed to load: %s. "
857 "See system logs and 'systemctl status %s' for details.",
859 strerror(-unit->load_error),
864 if (type != JOB_STOP && unit->load_state == UNIT_MASKED) {
865 dbus_set_error(e, BUS_ERROR_MASKED, "Unit %s is masked.", unit->id);
869 if (!unit_job_is_applicable(unit, type)) {
870 dbus_set_error(e, BUS_ERROR_JOB_TYPE_NOT_APPLICABLE, "Job type %s is not applicable for unit %s.", job_type_to_string(type), unit->id);
874 /* First add the job. */
875 ret = transaction_add_one_job(tr, type, unit, override, &is_new);
879 ret->ignore_order = ret->ignore_order || ignore_order;
881 /* Then, add a link to the job. */
882 l = job_dependency_new(by, ret, matters, conflicts);
886 /* If the link has no subject job, it's the anchor link. */
888 LIST_PREPEND(JobDependency, subject, tr->anchor, l);
889 assert(!tr->anchor_job);
890 tr->anchor_job = ret;
893 if (is_new && !ignore_requirements) {
896 /* If we are following some other unit, make sure we
897 * add all dependencies of everybody following. */
898 if (unit_following_set(ret->unit, &following) > 0) {
899 SET_FOREACH(dep, following, i) {
900 r = transaction_add_job_and_dependencies(tr, type, dep, ret, false, override, false, false, ignore_order, e);
902 log_warning("Cannot add dependency job for unit %s, ignoring: %s", dep->id, bus_error(e, r));
912 /* Finally, recursively add in all dependencies. */
913 if (type == JOB_START || type == JOB_RELOAD_OR_START) {
914 SET_FOREACH(dep, ret->unit->dependencies[UNIT_REQUIRES], i) {
915 r = transaction_add_job_and_dependencies(tr, JOB_START, dep, ret, true, override, false, false, ignore_order, e);
925 SET_FOREACH(dep, ret->unit->dependencies[UNIT_BIND_TO], i) {
926 r = transaction_add_job_and_dependencies(tr, JOB_START, dep, ret, true, override, false, false, ignore_order, e);
936 SET_FOREACH(dep, ret->unit->dependencies[UNIT_REQUIRES_OVERRIDABLE], i) {
937 r = transaction_add_job_and_dependencies(tr, JOB_START, dep, ret, !override, override, false, false, ignore_order, e);
939 log_warning("Cannot add dependency job for unit %s, ignoring: %s", dep->id, bus_error(e, r));
946 SET_FOREACH(dep, ret->unit->dependencies[UNIT_WANTS], i) {
947 r = transaction_add_job_and_dependencies(tr, JOB_START, dep, ret, false, false, false, false, ignore_order, e);
949 log_warning("Cannot add dependency job for unit %s, ignoring: %s", dep->id, bus_error(e, r));
956 SET_FOREACH(dep, ret->unit->dependencies[UNIT_REQUISITE], i) {
957 r = transaction_add_job_and_dependencies(tr, JOB_VERIFY_ACTIVE, dep, ret, true, override, false, false, ignore_order, e);
967 SET_FOREACH(dep, ret->unit->dependencies[UNIT_REQUISITE_OVERRIDABLE], i) {
968 r = transaction_add_job_and_dependencies(tr, JOB_VERIFY_ACTIVE, dep, ret, !override, override, false, false, ignore_order, e);
970 log_warning("Cannot add dependency job for unit %s, ignoring: %s", dep->id, bus_error(e, r));
977 SET_FOREACH(dep, ret->unit->dependencies[UNIT_CONFLICTS], i) {
978 r = transaction_add_job_and_dependencies(tr, JOB_STOP, dep, ret, true, override, true, false, ignore_order, e);
988 SET_FOREACH(dep, ret->unit->dependencies[UNIT_CONFLICTED_BY], i) {
989 r = transaction_add_job_and_dependencies(tr, JOB_STOP, dep, ret, false, override, false, false, ignore_order, e);
991 log_warning("Cannot add dependency job for unit %s, ignoring: %s", dep->id, bus_error(e, r));
1000 if (type == JOB_STOP || type == JOB_RESTART || type == JOB_TRY_RESTART) {
1002 SET_FOREACH(dep, ret->unit->dependencies[UNIT_REQUIRED_BY], i) {
1003 r = transaction_add_job_and_dependencies(tr, type, dep, ret, true, override, false, false, ignore_order, e);
1013 SET_FOREACH(dep, ret->unit->dependencies[UNIT_BOUND_BY], i) {
1014 r = transaction_add_job_and_dependencies(tr, type, dep, ret, true, override, false, false, ignore_order, e);
1025 if (type == JOB_RELOAD || type == JOB_RELOAD_OR_START) {
1027 SET_FOREACH(dep, ret->unit->dependencies[UNIT_PROPAGATE_RELOAD_TO], i) {
1028 r = transaction_add_job_and_dependencies(tr, JOB_RELOAD, dep, ret, false, override, false, false, ignore_order, e);
1030 log_warning("Cannot add dependency reload job for unit %s, ignoring: %s", dep->id, bus_error(e, r));
1038 /* JOB_VERIFY_STARTED, JOB_RELOAD require no dependency handling */
1047 int transaction_add_isolate_jobs(Transaction *tr, Manager *m) {
1056 HASHMAP_FOREACH_KEY(u, k, m->units, i) {
1058 /* ignore aliases */
1062 if (u->ignore_on_isolate)
1065 /* No need to stop inactive jobs */
1066 if (UNIT_IS_INACTIVE_OR_FAILED(unit_active_state(u)) && !u->job)
1069 /* Is there already something listed for this? */
1070 if (hashmap_get(tr->jobs, u))
1073 r = transaction_add_job_and_dependencies(tr, JOB_STOP, u, tr->anchor_job, true, false, false, false, false, NULL);
1075 log_warning("Cannot add isolate job for unit %s, ignoring: %s", u->id, strerror(-r));
1081 Transaction *transaction_new(void) {
1084 tr = new0(Transaction, 1);
1088 tr->jobs = hashmap_new(trivial_hash_func, trivial_compare_func);
1097 void transaction_free(Transaction *tr) {
1098 assert(hashmap_isempty(tr->jobs));
1099 hashmap_free(tr->jobs);