core: don't track jobs-finishing-during-reload explicitly

Memory management is borked for this, and moreover this is unnecessary
since f0831ed2a0, i.e. since coldplug() and catchup() are two different
concepts: the former restoring the state from before a reload, the
latter than adjusting it again to the actual status in effect after the
reload.

Fixes: #10716
Mostly reverts: #8803
This commit is contained in:
Lennart Poettering 2018-12-10 18:52:28 +01:00
parent 728ba51e98
commit 4a53080be6
4 changed files with 1 additions and 37 deletions

View file

@ -260,7 +260,6 @@ int job_install_deserialized(Job *j) {
*pj = j;
j->installed = true;
j->reloaded = true;
if (j->state == JOB_RUNNING)
j->unit->manager->n_running_jobs++;
@ -968,19 +967,6 @@ static void job_fail_dependencies(Unit *u, UnitDependency d) {
}
}
static int job_save_pending_finished_job(Job *j) {
int r;
assert(j);
r = set_ensure_allocated(&j->manager->pending_finished_jobs, NULL);
if (r < 0)
return r;
job_unlink(j);
return set_put(j->manager->pending_finished_jobs, j);
}
int job_finish_and_invalidate(Job *j, JobResult result, bool recursive, bool already) {
Unit *u;
Unit *other;
@ -1020,11 +1006,7 @@ int job_finish_and_invalidate(Job *j, JobResult result, bool recursive, bool alr
j->manager->n_failed_jobs++;
job_uninstall(j);
/* Keep jobs started before the reload to send singal later, free all others */
if (!MANAGER_IS_RELOADING(j->manager) ||
!j->reloaded ||
job_save_pending_finished_job(j) < 0)
job_free(j);
job_free(j);
/* Fail depending jobs on failure */
if (result != JOB_DONE && recursive) {

View file

@ -156,7 +156,6 @@ struct Job {
bool irreversible:1;
bool in_gc_queue:1;
bool ref_by_private_bus:1;
bool reloaded:1;
};
Job* job_new(Unit *unit, JobType type);

View file

@ -3464,17 +3464,6 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
return manager_deserialize_units(m, f, fds);
}
static void manager_flush_finished_jobs(Manager *m) {
Job *j;
while ((j = set_steal_first(m->pending_finished_jobs))) {
bus_job_send_removed_signal(j);
job_free(j);
}
m->pending_finished_jobs = set_free(m->pending_finished_jobs);
}
int manager_reload(Manager *m) {
_cleanup_(manager_reloading_stopp) Manager *reloading = NULL;
_cleanup_fdset_free_ FDSet *fds = NULL;
@ -3560,9 +3549,6 @@ int manager_reload(Manager *m) {
manager_ready(m);
if (!MANAGER_IS_RELOADING(m))
manager_flush_finished_jobs(m);
m->send_reloading_done = true;
return 0;
}

View file

@ -337,9 +337,6 @@ struct Manager {
/* non-zero if we are reloading or reexecuting, */
int n_reloading;
/* A set which contains all jobs that started before reload and finished
* during it */
Set *pending_finished_jobs;
unsigned n_installed_jobs;
unsigned n_failed_jobs;