[systemd-devel] bug 88401 / daemon-reload causes Type=oneshot services to be re-started / path_coldplug() is non-deserialization-aware

Ivan Shapovalov intelfx100 at gmail.com
Sat Jan 17 18:24:27 PST 2015


On 2015-01-18 at 04:21 +0300, Ivan Shapovalov wrote:
> [...]
> Questions:
> - is my analysis correct?
> - if yes, then how to fix this? Maybe add a similar
>   "if (UNIT(p)->manager->n_reloading <= 0)" check to
>   path_enter_running() to avoid calling manager_add_job() during
>   reloading?

Here's what I have in mind:

From 829c474acb861619c01e04da58ee44fa25507fd9 Mon Sep 17 00:00:00 2001
From: Ivan Shapovalov <intelfx100 at gmail.com>
Date: Sun, 18 Jan 2015 04:27:04 +0300
Subject: [PATCH] core/path: do not add any jobs when changing state during
 reload

---
 src/core/path.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/core/path.c b/src/core/path.c
index 0fdf483..d2b35e4 100644
--- a/src/core/path.c
+++ b/src/core/path.c
@@ -477,10 +477,12 @@ static void path_enter_running(Path *p) {
         if (unit_stop_pending(UNIT(p)))
                 return;
 
-        r = manager_add_job(UNIT(p)->manager, JOB_START, UNIT_TRIGGER(UNIT(p)),
-                            JOB_REPLACE, true, &error, NULL);
-        if (r < 0)
-                goto fail;
+        if (UNIT(p)->manager->n_reloading <= 0) {
+                r = manager_add_job(UNIT(p)->manager, JOB_START, UNIT_TRIGGER(UNIT(p)),
+                                    JOB_REPLACE, true, &error, NULL);
+                if (r < 0)
+                        goto fail;
+        }
 
         p->inotify_triggered = false;
 
-- 
2.2.2

-- 
Ivan Shapovalov / intelfx /


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 213 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150118/f4a9c619/attachment.sig>


More information about the systemd-devel mailing list