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 <intelfx...@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 /


Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to