anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

Blame SOURCES/0479-core-reinstate-propagation-of-stop-restart-jobs-via-.patch

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