summaryrefslogtreecommitdiffstats
path: root/src/core/manager.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-04-08 22:05:15 +0200
committerLennart Poettering <lennart@poettering.net>2021-05-25 16:03:03 +0200
commit56c595920220adcc2cedacfada8f9a1000a3c878 (patch)
treee23273309a1dac9c3dd49d7cd05dd3917a414b0d /src/core/manager.h
parentcore: make unneeded check a bit tighter (diff)
downloadsystemd-56c595920220adcc2cedacfada8f9a1000a3c878.tar.xz
systemd-56c595920220adcc2cedacfada8f9a1000a3c878.zip
core: change BoundBy= dependency handling to be processed by a deferred work queue
So far StopWhenUnneeded= handling and UpheldBy= handling was already processed by a queue that is dispatched in a deferred mode of operation instead of instantly. This changes BoundBy= handling to be processed the same way. This should ensure that all *event*-to-job propagation is done directly from unit_notify(), while all *state*-to-job propagation is done from a deferred work queue, quite systematically. The work queue is submitted to by unit_notify() too. Key really is the difference between event and state: some jobs shall be queued one-time on events (think: OnFailure= + OnSuccess= and similar), others shall be queued continuously when a specific state is in effect (think: UpheldBy=). The latter cases are usually effect of the combination of states of a few units (e.g. StopWhenUnneeded= checks wether any of the Wants=/Requires=/… deps are still up before acting), and hence it makes sense to trigger them to be run after an individual unit's state changed, but process them on a queue that runs whenever there's nothing else to do that ensures the decision on them is only taken after all jobs/queued IO events are dispatched, and things settled, so that it makes sense to come to a combined conclusion. If we'd dispatch this work immediately inside of unit_notify() we'd always act instantly, even though another event from another unit that is already queued might make the work unnecessary or invalid. This is mostly a commit to make things philosophically clean. It does not add features, but it should make corner cases more robust.
Diffstat (limited to 'src/core/manager.h')
-rw-r--r--src/core/manager.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/core/manager.h b/src/core/manager.h
index bfb8b628e7..c4d4b2c375 100644
--- a/src/core/manager.h
+++ b/src/core/manager.h
@@ -190,6 +190,9 @@ struct Manager {
/* Units which are upheld by another other which we might need to act on */
LIST_HEAD(Unit, start_when_upheld_queue);
+ /* Units that have BindsTo= another unit, and might need to be shutdown because the bound unit is not active. */
+ LIST_HEAD(Unit, stop_when_bound_queue);
+
sd_event *event;
/* This maps PIDs we care about to units that are interested in. We allow multiple units to he interested in