summaryrefslogtreecommitdiff
path: root/src/core/unit.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-11-15 19:32:50 +0100
committerLennart Poettering <lennart@poettering.net>2016-11-16 15:03:26 +0100
commitc5a97ed132b400ad82f7939d55fe1027a2b13f6e (patch)
tree924df71be2f04a66a30faccc54354d34c94f42ff /src/core/unit.c
parent1a465207ab0a0b6756ab0d9305102d9159955a14 (diff)
core: GC redundant device jobs from the run queue
In contrast to all other unit types device units when queued just track external state, they cannot effect state changes on their own. Hence unless a client or other job waits for them there's no reason to keep them in the job queue. This adds a concept of GC'ing jobs of this type as soon as no client or other job waits for them anymore. To ensure this works correctly we need to track which clients actually reference a job (i.e. which ones enqueued it). Unfortunately that's pretty nasty to do for direct connections, as sd_bus_track doesn't work for them. For now, work around this, by simply remembering in a boolean that a job was requested by a direct connection, and reset it when we notice the direct connection is gone. This means the GC logic works fine, except that jobs are not immediately removed when direct connections disconnect. In the longer term, a rework of the bus logic should fix this properly. For now this should be good enough, as GC works for fine all cases except this one, and thus is a clear improvement over the previous behaviour. Fixes: #1921
Diffstat (limited to 'src/core/unit.c')
-rw-r--r--src/core/unit.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index df60a5bf04..fbb21e4985 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -389,7 +389,7 @@ void unit_add_to_gc_queue(Unit *u) {
if (unit_check_gc(u))
return;
- LIST_PREPEND(gc_queue, u->manager->gc_queue, u);
+ LIST_PREPEND(gc_queue, u->manager->gc_unit_queue, u);
u->in_gc_queue = true;
}
@@ -569,7 +569,7 @@ void unit_free(Unit *u) {
LIST_REMOVE(cleanup_queue, u->manager->cleanup_queue, u);
if (u->in_gc_queue)
- LIST_REMOVE(gc_queue, u->manager->gc_queue, u);
+ LIST_REMOVE(gc_queue, u->manager->gc_unit_queue, u);
if (u->in_cgroup_queue)
LIST_REMOVE(cgroup_queue, u->manager->cgroup_queue, u);