core: don't track jobs-finishing-during-reload explicitly
authorLennart Poettering <lennart@poettering.net>
Mon, 10 Dec 2018 17:52:28 +0000 (18:52 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 12 Dec 2018 10:15:06 +0000 (11:15 +0100)
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

src/core/job.c
src/core/job.h
src/core/manager.c
src/core/manager.h

index 0f224f2..7fa3673 100644 (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) {
index 1f5bce8..649f812 100644 (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);
index 2398dcf..35d9753 100644 (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;
 }
index f3ad44d..bce8020 100644 (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;