X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fmanager.c;h=495c8e6ba359b83c76fc889ade2705e3ded74dbf;hb=7640a5de1b3ffe6547200ad204d14e4f067caf4f;hp=e723a1e4ef115b8aece3ca5755541ce84bc6ca1d;hpb=d718bbb51bd811212c149f5ac3e9233907ebb36e;p=elogind.git diff --git a/src/manager.c b/src/manager.c index e723a1e4e..495c8e6ba 100644 --- a/src/manager.c +++ b/src/manager.c @@ -1187,13 +1187,27 @@ static void transaction_minimize_impact(Manager *m) { } while (again); } -static int transaction_apply(Manager *m) { +static int transaction_apply(Manager *m, JobMode mode) { Iterator i; Job *j; int r; /* Moves the transaction jobs to the set of active jobs */ + if (mode == JOB_ISOLATE) { + + /* When isolating first kill all installed jobs which + * aren't part of the new transaction */ + HASHMAP_FOREACH(j, m->jobs, i) { + assert(j->installed); + + if (hashmap_get(m->transaction_jobs, j->unit)) + continue; + + job_finish_and_invalidate(j, JOB_CANCELED); + } + } + HASHMAP_FOREACH(j, m->transaction_jobs, i) { /* Assume merged */ assert(!j->transaction_prev); @@ -1322,7 +1336,7 @@ static int transaction_activate(Manager *m, JobMode mode, DBusError *e) { } /* Tenth step: apply changes */ - if ((r = transaction_apply(m)) < 0) { + if ((r = transaction_apply(m, mode)) < 0) { log_warning("Failed to apply transaction: %s", strerror(-r)); goto rollback; } @@ -1619,7 +1633,7 @@ static int transaction_add_isolate_jobs(Manager *m) { if (u->meta.id != k) continue; - if (UNIT_VTABLE(u)->no_isolate) + if (u->meta.ignore_on_isolate) continue; /* No need to stop inactive jobs */