File 1014-mdmon-compensate-for-removal-of-KillMode-none.patch of Package mdadm.28825
From c21189378cc293280e36e3d999e3105d97458a6b Mon Sep 17 00:00:00 2001 From: NeilBrown <neilb@suse.de> Date: Mon, 23 Jan 2023 14:29:16 +1100 Subject: [PATCH] mdmon: compensate for removal of KillMode=none mdmon needs to keep running during the switchroot out of (at boot) and then back into (at shutdown) the initrd. It runs until a new mdmon takes over. Killmode=none used to achieve this, with the help of --offroot which sets argv[0][0] to '@' which systemd understands. However mdmon currently is run in system-mdmon.slice which conflicts with shutdown.target so mdmon get killed early in shutdown when system.mdmon.slice is removed. As described in systemd.service(5), this conflict which shutdown can be resolved by requesting system.slice, which is a natural counterpart to DefaultDependencies=no. So add that, and also add IgnoreOnIsolate=true to avoid another possible source of an early death. Signed-off-by: NeilBrown <neilb@suse.de> --- systemd/mdmon@.service | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/systemd/mdmon@.service +++ b/systemd/mdmon@.service @@ -9,6 +9,9 @@ Description=MD Metadata Monitor on /dev/%I DefaultDependencies=no Before=initrd-switch-root.target +# allow this to keep running after switchroot, until a new +# instance is started +IgnoreOnIsolate=true [Service] # The mdmon starting in the initramfs (with dracut at least) @@ -21,4 +24,6 @@ ExecStart=BINDIR/mdmon --foreground --of # it out) and systemd will remove it when transitioning from # initramfs to rootfs. #PIDFile=/run/mdadm/%I.pid -KillMode=none +# The default slice is system-mdmon.slice which Conflicts +# with shutdown, causing mdmon to exit early. So use system.slice. +Slice=system.slice