The following comment confuses me:
It just so happens, that dracut has code in the shutdown routine, which shuts down all raid arrays...
For non-root disks this should be part of an mdadm service.
Linux has supported root on software RAID for many years, without the more powerful shutdown to initramfs technique supported by dracut. So I've double-checked and it still works fine on Debian 9, which doesn't have dracut or
/run/initramfs/shutdown. Rebooting it does not cause a resync to show up in
/proc/mdstat. There's actually no
mdadm.service in /lib/systemd/system, only a mask file to disable
/etc/init.d/mdadm, whatever that did.
What is the significance of userspace stopping RAID arrays during shutdown using
mdadm? Why does dracut do this? Is it ever necessary to do this to avoid an unclean shutdown of the array (requiring a future resync), as encountered in the bug linked above? I notice the original bug report is about IMSM, which mdadm does not support all features of.
Or is the only significance that if userspace drives the process, it can respond to errors e.g. showing some more comprehensive message than the kernel would have, attempting to log it somewhere, etc?