mirror of
https://github.com/systemd/systemd.git
synced 2025-01-27 18:04:05 +03:00
unit: if a unit external changes state, consider that good enough for a job to succeed, don't enforce waiting for the dependencies
This commit is contained in:
parent
2149e37c79
commit
b410e6b951
16
src/unit.c
16
src/unit.c
@ -969,13 +969,10 @@ 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) {
|
||||
|
||||
@ -984,7 +981,7 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns) {
|
||||
|
||||
if (UNIT_IS_ACTIVE_OR_RELOADING(ns))
|
||||
job_finish_and_invalidate(u->meta.job, true);
|
||||
else if (ns != UNIT_ACTIVATING) {
|
||||
else if (u->meta.job->state == JOB_RUNNING && ns != UNIT_ACTIVATING) {
|
||||
unexpected = true;
|
||||
job_finish_and_invalidate(u->meta.job, false);
|
||||
}
|
||||
@ -994,12 +991,14 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns) {
|
||||
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;
|
||||
|
||||
@ -1009,7 +1008,7 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns) {
|
||||
|
||||
if (ns == UNIT_INACTIVE)
|
||||
job_finish_and_invalidate(u->meta.job, true);
|
||||
else if (ns != UNIT_DEACTIVATING) {
|
||||
else if (u->meta.job->state == JOB_RUNNING && ns != UNIT_DEACTIVATING) {
|
||||
unexpected = true;
|
||||
job_finish_and_invalidate(u->meta.job, false);
|
||||
}
|
||||
@ -1020,7 +1019,6 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns) {
|
||||
assert_not_reached("Job type unknown");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If this state change happened without being requested by a
|
||||
* job, then let's retroactively start or stop dependencies */
|
||||
|
Loading…
x
Reference in New Issue
Block a user