X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fjob.c;h=4700aab6acfb41963fbc8660a8c579299c370b9c;hb=4dba533a137486719fb385c45fc2ff75593fdf53;hp=0b6d321e991b74aafcad7b7a6110624777636e51;hpb=0ebd74d8d9ffc4ea47cc8fe8798466bdf4e6967f;p=elogind.git diff --git a/src/job.c b/src/job.c index 0b6d321e9..4700aab6a 100644 --- a/src/job.c +++ b/src/job.c @@ -309,8 +309,12 @@ bool job_is_runnable(Job *j) { /* Checks whether there is any job running for the units this * job needs to be running after (in the case of a 'positive' - * job type) or before (in the case of a 'negative' job type - * . */ + * job type) or before (in the case of a 'negative' job + * type. */ + + /* First check if there is an override */ + if (j->ignore_deps) + return true; if (j->type == JOB_START || j->type == JOB_VERIFY_ACTIVE || @@ -385,6 +389,9 @@ int job_run_and_invalidate(Job *j) { case JOB_START: r = unit_start(j->unit); + + /* If this unit cannot be started, then simply + * wait */ if (r == -EBADR) r = 0; break; @@ -402,6 +409,11 @@ int job_run_and_invalidate(Job *j) { case JOB_STOP: r = unit_stop(j->unit); + + /* If this unit cannot stopped, then simply + * wait. */ + if (r == -EBADR) + r = 0; break; case JOB_RELOAD: @@ -490,7 +502,7 @@ int job_finish_and_invalidate(Job *j, bool success) { job_free(j); if (!success && j->type == JOB_START) - unit_status_printf(u, "Starting %s " ANSI_HIGHLIGHT_ON "failed" ANSI_HIGHLIGHT_OFF ".\n", unit_description(u)); + unit_status_printf(u, "Starting %s " ANSI_HIGHLIGHT_ON "failed" ANSI_HIGHLIGHT_OFF ", see 'systemctl status %s' for details.\n", unit_description(u), u->meta.id); /* Fail depending jobs on failure */ if (!success) { @@ -500,35 +512,31 @@ int job_finish_and_invalidate(Job *j, bool success) { t == JOB_RELOAD_OR_START) { SET_FOREACH(other, u->meta.dependencies[UNIT_REQUIRED_BY], i) - if (!other->meta.ignore_dependency_failure && - other->meta.job && + if (other->meta.job && (other->meta.job->type == JOB_START || other->meta.job->type == JOB_VERIFY_ACTIVE || other->meta.job->type == JOB_RELOAD_OR_START)) job_finish_and_invalidate(other->meta.job, false); - SET_FOREACH(other, u->meta.dependencies[UNIT_REQUIRED_BY_OVERRIDABLE], i) - if (!other->meta.ignore_dependency_failure && - other->meta.job && - !other->meta.job->override && + SET_FOREACH(other, u->meta.dependencies[UNIT_BOUND_BY], i) + if (other->meta.job && (other->meta.job->type == JOB_START || other->meta.job->type == JOB_VERIFY_ACTIVE || other->meta.job->type == JOB_RELOAD_OR_START)) job_finish_and_invalidate(other->meta.job, false); - } else if (t == JOB_STOP) { - - SET_FOREACH(other, u->meta.dependencies[UNIT_CONFLICTS], i) - if (!other->meta.ignore_dependency_failure && - other->meta.job && + SET_FOREACH(other, u->meta.dependencies[UNIT_REQUIRED_BY_OVERRIDABLE], i) + if (other->meta.job && + !other->meta.job->override && (other->meta.job->type == JOB_START || other->meta.job->type == JOB_VERIFY_ACTIVE || other->meta.job->type == JOB_RELOAD_OR_START)) job_finish_and_invalidate(other->meta.job, false); + } else if (t == JOB_STOP) { + SET_FOREACH(other, u->meta.dependencies[UNIT_CONFLICTED_BY], i) - if (!other->meta.ignore_dependency_failure && - other->meta.job && + if (other->meta.job && (other->meta.job->type == JOB_START || other->meta.job->type == JOB_VERIFY_ACTIVE || other->meta.job->type == JOB_RELOAD_OR_START)) @@ -663,7 +671,8 @@ DEFINE_STRING_TABLE_LOOKUP(job_type, JobType); static const char* const job_mode_table[_JOB_MODE_MAX] = { [JOB_FAIL] = "fail", [JOB_REPLACE] = "replace", - [JOB_ISOLATE] = "isolate" + [JOB_ISOLATE] = "isolate", + [JOB_IGNORE_DEPENDENCIES] = "ignore-dependencies" }; DEFINE_STRING_TABLE_LOOKUP(job_mode, JobMode);