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