summaryrefslogtreecommitdiff
path: root/src/core/unit.c
diff options
context:
space:
mode:
authorOleksii Shevchuk <alxchk@gmail.com>2013-02-14 00:49:26 +0200
committerLennart Poettering <lennart@poettering.net>2013-03-01 15:11:35 +0100
commitbf6dcfa6a79a459239799a21bdcba115d696a006 (patch)
tree2df71621bb582c5d800305a494e3d5c0cfed22ee /src/core/unit.c
parent92094b75fb8629492cddab1677a29830a7d96811 (diff)
unit: fix the race in deserialization.
unit_notify is fired in deserelization code (particulary in service_set_state). Units passed in random order, and there is possibility, that unit with StopWhenUnneeded=yes passed before it actual dependecies. In that case unit will be stopped as unneeded, because deps in UNIT_INACTIVE state yet. So, reuse similar logic (unit.c:1421) to avoid this race
Diffstat (limited to 'src/core/unit.c')
-rw-r--r--src/core/unit.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index e2c06ae8b6..601be60ed0 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -1517,7 +1517,8 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su
/* Maybe we finished startup and are now ready for being
* stopped because unneeded? */
- unit_check_unneeded(u);
+ if (u->manager->n_reloading <= 0)
+ unit_check_unneeded(u);
unit_add_to_dbus_queue(u);
unit_add_to_gc_queue(u);