Memory management is borked for this, and moreover this is unnecessary
since
f0831ed2a03, 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
*pj = j;
j->installed = true;
- j->reloaded = true;
if (j->state == JOB_RUNNING)
j->unit->manager->n_running_jobs++;
}
}
-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;
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) {
bool irreversible:1;
bool in_gc_queue:1;
bool ref_by_private_bus:1;
- bool reloaded:1;
};
Job* job_new(Unit *unit, JobType type);
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;
manager_ready(m);
- if (!MANAGER_IS_RELOADING(m))
- manager_flush_finished_jobs(m);
-
m->send_reloading_done = true;
return 0;
}
/* 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;