mirror of
https://github.com/systemd/systemd.git
synced 2025-01-11 09:18:07 +03:00
systemd: treat reload failure as failure
systemctl reload "suceeded" on stopped units, but it is documented to fail in this case. https://bugzilla.redhat.com/show_bug.cgi?id=1036845
This commit is contained in:
parent
c71ecee578
commit
6a371e23ee
Notes:
Zbigniew Jędrzejewski-Szmek
2013-12-03 18:48:34 -05:00
Backport: bugfix
@ -508,7 +508,7 @@ int job_run_and_invalidate(Job *j) {
|
|||||||
else if (t == UNIT_ACTIVATING)
|
else if (t == UNIT_ACTIVATING)
|
||||||
r = -EAGAIN;
|
r = -EAGAIN;
|
||||||
else
|
else
|
||||||
r = -ENOEXEC;
|
r = -EBADR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -537,8 +537,10 @@ int job_run_and_invalidate(Job *j) {
|
|||||||
if (j) {
|
if (j) {
|
||||||
if (r == -EALREADY)
|
if (r == -EALREADY)
|
||||||
r = job_finish_and_invalidate(j, JOB_DONE, true);
|
r = job_finish_and_invalidate(j, JOB_DONE, true);
|
||||||
else if (r == -ENOEXEC)
|
else if (r == -EBADR)
|
||||||
r = job_finish_and_invalidate(j, JOB_SKIPPED, true);
|
r = job_finish_and_invalidate(j, JOB_SKIPPED, true);
|
||||||
|
else if (r == -ENOEXEC)
|
||||||
|
r = job_finish_and_invalidate(j, JOB_INVALID, true);
|
||||||
else if (r == -EAGAIN) {
|
else if (r == -EAGAIN) {
|
||||||
j->state = JOB_WAITING;
|
j->state = JOB_WAITING;
|
||||||
m->n_running_jobs--;
|
m->n_running_jobs--;
|
||||||
@ -764,7 +766,7 @@ int job_finish_and_invalidate(Job *j, JobResult result, bool recursive) {
|
|||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == JOB_FAILED)
|
if (result == JOB_FAILED || result == JOB_INVALID)
|
||||||
j->manager->n_failed_jobs ++;
|
j->manager->n_failed_jobs ++;
|
||||||
|
|
||||||
job_uninstall(j);
|
job_uninstall(j);
|
||||||
@ -1119,7 +1121,8 @@ static const char* const job_result_table[_JOB_RESULT_MAX] = {
|
|||||||
[JOB_TIMEOUT] = "timeout",
|
[JOB_TIMEOUT] = "timeout",
|
||||||
[JOB_FAILED] = "failed",
|
[JOB_FAILED] = "failed",
|
||||||
[JOB_DEPENDENCY] = "dependency",
|
[JOB_DEPENDENCY] = "dependency",
|
||||||
[JOB_SKIPPED] = "skipped"
|
[JOB_SKIPPED] = "skipped",
|
||||||
|
[JOB_INVALID] = "invalid",
|
||||||
};
|
};
|
||||||
|
|
||||||
DEFINE_STRING_TABLE_LOOKUP(job_result, JobResult);
|
DEFINE_STRING_TABLE_LOOKUP(job_result, JobResult);
|
||||||
|
@ -97,7 +97,8 @@ enum JobResult {
|
|||||||
JOB_TIMEOUT, /* JobTimeout elapsed */
|
JOB_TIMEOUT, /* JobTimeout elapsed */
|
||||||
JOB_FAILED, /* Job failed */
|
JOB_FAILED, /* Job failed */
|
||||||
JOB_DEPENDENCY, /* A required dependency job did not result in JOB_DONE */
|
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_SKIPPED, /* Negative result of JOB_VERIFY_ACTIVE */
|
||||||
|
JOB_INVALID, /* JOB_RELOAD of inactive unit */
|
||||||
_JOB_RESULT_MAX,
|
_JOB_RESULT_MAX,
|
||||||
_JOB_RESULT_INVALID = -1
|
_JOB_RESULT_INVALID = -1
|
||||||
};
|
};
|
||||||
|
@ -1301,8 +1301,11 @@ int unit_reload(Unit *u) {
|
|||||||
if (state == UNIT_RELOADING)
|
if (state == UNIT_RELOADING)
|
||||||
return -EALREADY;
|
return -EALREADY;
|
||||||
|
|
||||||
if (state != UNIT_ACTIVE)
|
if (state != UNIT_ACTIVE) {
|
||||||
|
log_warning_unit(u->id, "Unit %s cannot be reloaded because it is inactive.",
|
||||||
|
u->id);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
|
}
|
||||||
|
|
||||||
following = unit_following(u);
|
following = unit_following(u);
|
||||||
if (following) {
|
if (following) {
|
||||||
|
Loading…
Reference in New Issue
Block a user