summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-06-04 20:13:05 +0200
committerLennart Poettering <lennart@poettering.net>2010-06-04 20:13:41 +0200
commitb410e6b951695847619d18952bb9e2622c8b2bbf (patch)
treef70c214dea07e4d314da71dc17a57db08cbe8057
parent2149e37c7954fd98acd54269df5f5eca78eb9d5b (diff)
unit: if a unit external changes state, consider that good enough for a job to succeed, don't enforce waiting for the dependencies
-rw-r--r--src/unit.c62
1 files changed, 30 insertions, 32 deletions
diff --git a/src/unit.c b/src/unit.c
index bb2b8c2fe0..c08091942e 100644
--- a/src/unit.c
+++ b/src/unit.c
@@ -969,56 +969,54 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns) {
* failed previously due to EAGAIN. */
job_add_to_run_queue(u->meta.job);
- else {
- assert(u->meta.job->state == JOB_RUNNING);
- /* Let's check whether this state change
- * constitutes a finished job, or maybe
- * cotradicts a running job and hence needs to
- * invalidate jobs. */
+ /* Let's check whether this state change constitutes a
+ * finished job, or maybe cotradicts a running job and
+ * hence needs to invalidate jobs. */
- switch (u->meta.job->type) {
+ switch (u->meta.job->type) {
- case JOB_START:
- case JOB_VERIFY_ACTIVE:
+ case JOB_START:
+ case JOB_VERIFY_ACTIVE:
- if (UNIT_IS_ACTIVE_OR_RELOADING(ns))
- job_finish_and_invalidate(u->meta.job, true);
- else if (ns != UNIT_ACTIVATING) {
- unexpected = true;
- job_finish_and_invalidate(u->meta.job, false);
- }
+ if (UNIT_IS_ACTIVE_OR_RELOADING(ns))
+ job_finish_and_invalidate(u->meta.job, true);
+ else if (u->meta.job->state == JOB_RUNNING && ns != UNIT_ACTIVATING) {
+ unexpected = true;
+ job_finish_and_invalidate(u->meta.job, false);
+ }
- break;
+ break;
- case JOB_RELOAD:
- case JOB_RELOAD_OR_START:
+ case JOB_RELOAD:
+ case JOB_RELOAD_OR_START:
+ if (u->meta.job->state == JOB_RUNNING) {
if (ns == UNIT_ACTIVE)
job_finish_and_invalidate(u->meta.job, true);
else if (ns != UNIT_ACTIVATING && ns != UNIT_ACTIVE_RELOADING) {
unexpected = true;
job_finish_and_invalidate(u->meta.job, false);
}
+ }
- break;
+ break;
- case JOB_STOP:
- case JOB_RESTART:
- case JOB_TRY_RESTART:
+ case JOB_STOP:
+ case JOB_RESTART:
+ case JOB_TRY_RESTART:
- if (ns == UNIT_INACTIVE)
- job_finish_and_invalidate(u->meta.job, true);
- else if (ns != UNIT_DEACTIVATING) {
- unexpected = true;
- job_finish_and_invalidate(u->meta.job, false);
- }
+ if (ns == UNIT_INACTIVE)
+ job_finish_and_invalidate(u->meta.job, true);
+ else if (u->meta.job->state == JOB_RUNNING && ns != UNIT_DEACTIVATING) {
+ unexpected = true;
+ job_finish_and_invalidate(u->meta.job, false);
+ }
- break;
+ break;
- default:
- assert_not_reached("Job type unknown");
- }
+ default:
+ assert_not_reached("Job type unknown");
}
}