diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2012-03-28 00:42:27 +0200 |
---|---|---|
committer | Michal Schmidt <mschmidt@redhat.com> | 2012-03-28 11:13:13 +0200 |
commit | dd17d38879503f018fdf6bbff822970afcddb6f1 (patch) | |
tree | af7f662cd35c2ca1c039e507cb6abe167b37fc76 /src/set.h | |
parent | 6030831d5b85539a2a209b6d3a6f28b400207d78 (diff) |
job: fix loss of ordering with restart jobs
Suppose that foo.service/start is a job waiting on other job bar.service/start
to finish. And then foo.service/restart is enqueued (not using
--ignore-dependencies).
Currently this makes foo.service start immediately, forgetting about the
ordering to bar.service.
The runnability check for JOB_RESTART jobs looks only at dependencies for
stopping. That's actually correct, because restart jobs should be treated the
same as stop jobs at first. The bug is that job_run_and_invalidate() does not
treat them exactly the same as stop jobs. unit_start() gets called without
checking for the runnability of the converted JOB_START job.
The fix is to simplify the switch in job_run_and_invalidate(). Handle
JOB_RESTART identically to JOB_STOP.
Also simplify the handling of JOB_TRY_RESTART - just convert it to JOB_RESTART
if the unit is active and let it fall through to the JOB_RESTART case.
Similarly for JOB_RELOAD_OR_START - have a fall through to JOB_START.
In job_finish_and_invalidate() it's not necessary to check for JOB_TRY_RESTART
with JOB_DONE, because JOB_TRY_RESTART jobs will have been converted to
JOB_RESTART already.
Speeding up the restart of services in "auto-restart" state still works as
before.
Improves: https://bugzilla.redhat.com/show_bug.cgi?id=753586
but it's still not perfect. With this fix the try-restart action will wait for
the restart to complete in the right order, but the optimal behaviour would be
to finish quickly (without disturbing the start job).
Diffstat (limited to 'src/set.h')
0 files changed, 0 insertions, 0 deletions