On Wed, 24 Aug 2022 14:03:25 +0200 Michal Koutný <mkoutny@xxxxxxxx> wrote: > On Wed, Aug 24, 2022 at 11:52:39AM +0200, Mariusz Tkaczyk > <mariusz.tkaczyk@xxxxxxxxxxxxxxx> wrote: > > I removed those setting but it was something like: > > > > Before=initrd-switch-root.target dev-%I.device > > > > I can test more if you have suggestions. > > Sorry, I realize it won't work, device deps are restricted [1]. (I > considered relaxing that [2] in order to terminate loop devs properly.) > > > Will check but it can be considered as workaround, not as a solution. VROC > > arrays are automatically configured in installers, also users may mount them > > manually, without any additional settings (as standalone disk). We need to > > resolve it globally. > > It's not the only setup when a device requires a userspace daemon. > There is a generic solution for root devices [3] (when the daemon is > marked to run indefinitely). Yes, I know that trick and we are setting '@' to prevent systemd from killing it[1] but we do mdmon@ service restart after switch root. This is the simplest way to reopen descriptors. We can try to change that. It will be great if you can really prove that the mechanism is working. Do you know any project which really uses this functionality? > > The device job ordering dependencies during shutdown would need better > handling in systemd. (But I don't understand how much > mdmon@.serice is necessary for device existence and teardown.) > We need to handle dirty clean transaction. On shutdown, when umount is requested them filesystem could flush in flight data, and them kernel is waiting for mdmon to acknowledge the change in metadata[2]. Thanks, Mariusz [1] https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/tree/mdmon.c#n342 [2] https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/tree/mdmon-design.txt