You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

84 lines
4.0 KiB

From 7f72b471bbfd449f4261d12cc7b062f6e7034283 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 19 May 2015 17:40:50 +0200
Subject: [PATCH] core: reinstate propagation of stop/restart jobs via
RequsiteOf dependencies
This reverts the primary effect of be7d9ff730cb88d7c6a869dd5c47754c78ceaef2.
After all Requisite= should be close to Requires=, without the one
exception that it doesn't pull in dependencies on start. However,
reverse deps on stop/restart should be treated the same way as for
Restart=, and this is already documented in the man page, hence stick to
it.
http://lists.freedesktop.org/archives/systemd-devel/2015-May/032049.html
(cherry picked from commit ce74e76920dca603a12ef4bf605567965e9e7e45)
[msekleta: we didn't backport be7d9ff730cb88d7c6a869dd5c47754c78ceaef2
and hence we don't have UNIT_REQUISITE_OF. Note that this patch was
backported because it makes backports of followup patches easier]
Related: #1436021
---
src/core/transaction.c | 41 +++++++++++++----------------------------
1 file changed, 13 insertions(+), 28 deletions(-)
diff --git a/src/core/transaction.c b/src/core/transaction.c
index 57e9cb3f8..428b7671b 100644
--- a/src/core/transaction.c
+++ b/src/core/transaction.c
@@ -1008,40 +1008,25 @@ int transaction_add_job_and_dependencies(
}
if (type == JOB_STOP || type == JOB_RESTART) {
+ static const UnitDependency propagate_deps[] = {
+ UNIT_REQUIRED_BY,
+ UNIT_BOUND_BY,
+ UNIT_CONSISTS_OF,
+ };
- SET_FOREACH(dep, ret->unit->dependencies[UNIT_REQUIRED_BY], i) {
- r = transaction_add_job_and_dependencies(tr, type, dep, ret, true, override, false, false, ignore_order, e);
- if (r < 0) {
- if (r != -EBADR)
- goto fail;
-
- if (e)
- sd_bus_error_free(e);
- }
- }
-
- SET_FOREACH(dep, ret->unit->dependencies[UNIT_BOUND_BY], i) {
- r = transaction_add_job_and_dependencies(tr, type, dep, ret, true, override, false, false, ignore_order, e);
- if (r < 0) {
- if (r != -EBADR)
- goto fail;
+ unsigned j;
- if (e)
- sd_bus_error_free(e);
- }
- }
+ for (j = 0; j < ELEMENTSOF(propagate_deps); j++)
+ SET_FOREACH(dep, ret->unit->dependencies[propagate_deps[j]], i) {
- SET_FOREACH(dep, ret->unit->dependencies[UNIT_CONSISTS_OF], i) {
- r = transaction_add_job_and_dependencies(tr, type, dep, ret, true, override, false, false, ignore_order, e);
- if (r < 0) {
- if (r != -EBADR)
- goto fail;
+ r = transaction_add_job_and_dependencies(tr, type, dep, ret, true, override, false, false, ignore_order, e);
+ if (r < 0) {
+ if (r != -EBADR)
+ goto fail;
- if (e)
sd_bus_error_free(e);
+ }
}
- }
-
}
if (type == JOB_RELOAD) {