[pve-devel] [PATCH] dmeventd: ensure service gets stopped normally on shutdown

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Oct 2 13:15:54 CEST 2017


The service pf dmeventd, dm-eventd.service, uses
'DefaultDependencies=no' as it wants to start up very early in the
boot process.
But, this also removed the implicit 'Conflicts' and 'Before' settings
to the shutdown target, which is in charge of stopping all service
gracefully on poweroff, reboot or halt.
This caused that the service was not stopped on shutdown by the
normal systemd shutdown process, but only once the systemd-shutdown
service took over the role of PID 1 and send a SIGKILL to all
remaining processes after a few minutes of waiting.
systemd-shutdown sends SIGTERM initially but dmeventd feels to
important and just ignores that signal in this case, it seems that
a thread of it started to work again.

Lets add the shutdown target conflict again, so that it gets stopped
during the normal systemd shutdown process, previous to reaching
shutdown.target.
First, this allows the user o notice more easily the offending
process as its logged with journald still operating - which isn't the
case with systemd-shutdown as PID 1 anymore.
Secondly, at this stage the shutdown of dmeventd seems to succeed
always, probably as all event threads are idle here. Why this is not
the case for when it gets a SIGTERM from systemd-shutdown, as its
currently the case, its a bit strange but I could imagine that the
sync from systemd-shutdown causes a metadata change which triggers a
dm-eventd thread to become active again - thus letting dmeventd
ignore the SIGTERM here. This is to a certain amount speculation, but
a reasonable one, IMO.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 ...d-ensure-service-gets-stopped-on-shutdown.patch | 26 ++++++++++++++++++++++
 patchdir/series                                    |  1 +
 2 files changed, 27 insertions(+)
 create mode 100644 patchdir/0001-dmeventd-ensure-service-gets-stopped-on-shutdown.patch

diff --git a/patchdir/0001-dmeventd-ensure-service-gets-stopped-on-shutdown.patch b/patchdir/0001-dmeventd-ensure-service-gets-stopped-on-shutdown.patch
new file mode 100644
index 0000000..1a03817
--- /dev/null
+++ b/patchdir/0001-dmeventd-ensure-service-gets-stopped-on-shutdown.patch
@@ -0,0 +1,26 @@
+From 06907d7f8422892968e187d6b60fd7473af05e99 Mon Sep 17 00:00:00 2001
+From: Thomas Lamprecht <t.lamprecht at proxmox.com>
+Date: Mon, 2 Oct 2017 12:21:31 +0200
+Subject: [PATCH] dmeventd: ensure service gets stopped on shutdown
+
+Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
+---
+ scripts/dm_event_systemd_red_hat.service.in | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/scripts/dm_event_systemd_red_hat.service.in b/scripts/dm_event_systemd_red_hat.service.in
+index 7c607aaf2..a3284c810 100644
+--- a/scripts/dm_event_systemd_red_hat.service.in
++++ b/scripts/dm_event_systemd_red_hat.service.in
+@@ -4,6 +4,8 @@ Documentation=man:dmeventd(8)
+ Requires=dm-event.socket
+ After=dm-event.socket
+ Before=local-fs-pre.target
++Before=shutdown.target
++Conflicts=shutdown.target
+ DefaultDependencies=no
+ 
+ [Service]
+-- 
+2.11.0
+
diff --git a/patchdir/series b/patchdir/series
index 04c3677..aea2708 100644
--- a/patchdir/series
+++ b/patchdir/series
@@ -1,3 +1,4 @@
 0001-filter-zvols-and-PVE-VG-by-default.patch
 0002-enable-issue_discards-by-default.patch
 0003-disable-use-lvmetad.patch
+0001-dmeventd-ensure-service-gets-stopped-on-shutdown.patch
-- 
2.11.0




More information about the pve-devel mailing list