[systemd-devel] [PATCH] Remove device and its relatives when action is offlined
MUNEDA Takahiro
muneda.takahiro at jp.fujitsu.com
Fri Sep 6 19:41:05 PDT 2013
When an unit is called via udev rules like below, only first 'online'
works correctly. Even if 'offline' event has happen, device and its
relative data still exists inside systemd, then following online
events will be ignored since systemd thinks it's already done. The
device and its relatives should be removed when 'offline' event has
happened.
ACTION=="online|offline", TAG+="systemd", ENV{SYSTEMD_WANTS}="muneda@$devpath_$env{ACTION}.service"
Tested with
kernel-3.10.10-200.fc19.x86_64
systemd-204-9.fc19.x86_64
And I confirmed that this patch can apply cleanly on git HEAD
(a012ab5).
Thanks,
Takahiro
---
src/core/device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/device.c b/src/core/device.c
index 9fca82a..467c5ef 100644
--- a/src/core/device.c
+++ b/src/core/device.c
@@ -589,7 +589,7 @@ void device_fd_event(Manager *m, int events) {
ready = udev_device_get_property_value(dev, "SYSTEMD_READY");
- if (streq(action, "remove") || (ready && parse_boolean(ready) == 0)) {
+ if (streq(action, "remove") || streq(action, "offline") || (ready && parse_boolean(ready) == 0)) {
if ((r = device_process_removed_device(m, dev)) < 0) {
log_error("Failed to process udev device event: %s", strerror(-r));
goto fail;
--
1.8.3.1
More information about the systemd-devel
mailing list