Before they would only be started when the unit transitioned from
inactive to active state. Now, they will be started also on other
udev events.

https://bugzilla.redhat.com/show_bug.cgi?id=1026860:

we have an MD device holding an LVM PV. When it is detected, and the
systemd .device unit is created, the device is not yet ready to be
used. Later, after an udev change event, the device is ready and LVM
udev rules add a SYSTEMD_WANTS=lvm2-pvscan@xxx.service tag. But since
the device was active (in systemd's mind) before, the SYSTEMD_WANTS
service was not run.
---
 src/core/unit.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Hi,
this is a second attempt, with a better explanation. In goes on top
of the revert of first attempt. Comments?

Zbyszek

diff --git a/src/core/unit.c b/src/core/unit.c
index 6c2c4a0..23c7bd4 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -1542,14 +1542,14 @@ void unit_notify(Unit *u, UnitActiveState os, 
UnitActiveState ns, bool reload_su
                  * activated. */
 
                 if (unexpected) {
-                        if (UNIT_IS_INACTIVE_OR_FAILED(os) && 
UNIT_IS_ACTIVE_OR_ACTIVATING(ns))
+                        if (UNIT_IS_ACTIVE_OR_ACTIVATING(ns))
                                 retroactively_start_dependencies(u);
-                        else if (UNIT_IS_ACTIVE_OR_ACTIVATING(os) && 
UNIT_IS_INACTIVE_OR_DEACTIVATING(ns))
+                        else
                                 retroactively_stop_dependencies(u);
                 }
 
                 /* stop unneeded units regardless if going down was expected 
or not */
-                if (UNIT_IS_ACTIVE_OR_ACTIVATING(os) && 
UNIT_IS_INACTIVE_OR_DEACTIVATING(ns))
+                if (UNIT_IS_INACTIVE_OR_DEACTIVATING(ns))
                         check_unneeded_dependencies(u);
 
                 if (ns != os && ns == UNIT_FAILED) {
-- 
1.8.4.2

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

Reply via email to