Dear Neil, Thank you for your patch. Am 27.02.23 um 01:13 schrieb NeilBrown: For commit message summary, I’d use a statement – maybe: mdmon: Improve switchroot
We need a new mdmon@mdfoo instance to run in the root filesystem after switch root, as /sys and /dev are removed from the initrd. systemd will not start a new unit with the same name running while the old unit is still active, and we want the two mdmon processes to overlap in time to avoid any risk of deadlock which a write is attempted with no mdmon running.
I do not understand the part after *deadlock*.
So we need a different unit name in the initrd than in the root. Apart from the name, everything else should be the same. This is easily achieved using a different instance name as the mdmon@.service unit file already supports multiple instances (for different arrays). So start "mdmon@mdfoo.service" from root, but "mdmon@initrd-mdfoo.service" from the initrd. udev can tell which circumstance is the case by looking for /etc/initrd-release. continue_from_systemd() is enhanced so that the "initrd-" prefix can be requested. Teach mdmon that a container name like "initrd/foo" should be treated just like "foo". Note that systemd passes the instance name "initrd-foo" as "initrd/foo". We don't need a similar machanism at shutdown because dracut runs
mechanism
"mdmon --takeover --all" when appropriate. Signed-off-by: NeilBrown <neilb@xxxxxxx> --- Grow.c | 4 ++-- mdadm.h | 2 +- mdmon.c | 6 +++++- systemd/mdmon@.service | 2 +- udev-md-raid-arrays.rules | 3 ++- util.c | 7 ++++--- 6 files changed, 15 insertions(+), 9 deletions(-)
[…] Kind regards, Paul