[systemd-commits] 2 commits - src/core
Michal Schmidt
michich at kemper.freedesktop.org
Wed Oct 24 18:22:50 PDT 2012
src/core/job.c | 2 +-
src/core/job.h | 12 ++++++------
2 files changed, 7 insertions(+), 7 deletions(-)
New commits:
commit 1abc85b8d026a2d72442b0edaee5213d0ee73c1f
Author: Michal Schmidt <mschmidt at redhat.com>
Date: Thu Oct 25 02:31:49 2012 +0200
job: avoid recursion into transaction code from job cancelation
I hit an "assert(j->installed)" failure in transaction_apply(). Looking
into the backtrace I saw what happened:
1. The system was booting. var.mount/start was an installed job.
2. I pressed Ctrl+Alt+Del.
3. reboot.target was going to be isolated.
4. transaction_apply() proceeded to install a var.mount/stop job.
5. job_install() canceled the conflicting start job.
6. Depending jobs ended recursively with JOB_DEPENDENCY, among them was
local-fs.target/start.
7. Its OnFailure action triggered - emergency.target was now going to be
isolated.
8. We recursed back into transaction_apply() where the half-installed
var.mount/stop job confused us.
Recursing from job installation back into the transaction code cannot be
a good idea. Avoid the problem by canceling the conflicting job
non-recursively in job_install(). I don't think we'll miss anything by
not recursing here. After all, we are called from transaction_apply().
We will not be installing just this one job, but all jobs from a
transaction. All requirement dependencies will be included in it and
will be installed separately. Every transaction job will get a chance
to cancel its own conflicting installed job.
diff --git a/src/core/job.c b/src/core/job.c
index cb5674b..f08b8cb 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -180,7 +180,7 @@ Job* job_install(Job *j) {
if (uj) {
if (j->type != JOB_NOP && job_type_is_conflicting(uj->type, j->type))
- job_finish_and_invalidate(uj, JOB_CANCELED, true);
+ job_finish_and_invalidate(uj, JOB_CANCELED, false);
else {
/* not conflicting, i.e. mergeable */
commit 65eb544e12343f314ffb5f07119aa1be502d975c
Author: Michal Schmidt <mschmidt at redhat.com>
Date: Thu Oct 25 01:22:22 2012 +0200
job: add comments to JobResult values
diff --git a/src/core/job.h b/src/core/job.h
index 349fb68..3aa49d4 100644
--- a/src/core/job.h
+++ b/src/core/job.h
@@ -91,12 +91,12 @@ enum JobMode {
};
enum JobResult {
- JOB_DONE,
- JOB_CANCELED,
- JOB_TIMEOUT,
- JOB_FAILED,
- JOB_DEPENDENCY,
- JOB_SKIPPED,
+ JOB_DONE, /* Job completed successfully */
+ JOB_CANCELED, /* Job canceled by a conflicting job installation or by explicit cancel request */
+ JOB_TIMEOUT, /* JobTimeout elapsed */
+ JOB_FAILED, /* Job failed */
+ JOB_DEPENDENCY, /* A required dependency job did not result in JOB_DONE */
+ JOB_SKIPPED, /* JOB_RELOAD of inactive unit; negative result of JOB_VERIFY_ACTIVE */
_JOB_RESULT_MAX,
_JOB_RESULT_INVALID = -1
};
More information about the systemd-commits
mailing list