On Wed, Nov 2, 2011 at 8:17 AM, Lennart Poettering <lennart@xxxxxxxxxxxxxx> wrote: > On Wed, 02.11.11 15:33, Kay Sievers (kay.sievers@xxxxxxxx) wrote: > >> > The big thing is that if things are done that way you'll always have the >> > chicken and egg problem: you really need to shut down mdmon before >> > unmounting root, but currently you require us to do it in the other >> > order too. >> >> Yeah, that's just madness. >> >> I talked to Harald, and the currently preferred idea is the version >> where we start mdmon in the initramfs and never touch it again, and it >> runs until the initramfs unmounts the rootfs and shuts down the box. >> >> In that picture, the mdmon process is conceptually more like a kernel >> thread than a userspace process. It can not be updated, can not be >> restarted. The only way to update it is to rebuild initramfs and >> reboot the box. > > OK, I guess that means we'll need to define a way how we can recognize > the process then, to avoid killing it by systemd, similar to how we > exclude kernel threads from killing. > > Kernel threads we detect by checking whether /proc/$PID/cmdline is > empty, hence I'd suggest we use the first char of argv[0][0] here, to > detect whether something is a process to avoid killing. Question is > which char to choose for that. I am tempted to use '@'. > > That means we'd: > > a) patch systemd to check whether argv[0][0] of a process is '@' and > owned by root and exclude it from killing on shutdown. > > b) patch mdmon to set argv[0][0] of itself to '@' iff it is running from > the initrd. If it is run from the main system it should not set that and > just be shut down like any other service. Well, there are two cases to consider: 1/ user starts the array manually and stops it with mdadm -Ss (mdmon automatically shuts down). No need for a service mdmon just follows the lifespan of the array. 2/ user starts the array but then expects it to be around until system shutdown In the latter case let the initramfs-mdmon takeover all arrays with "mdmon --takeover --all". But if all arrays may eventually be re-parented to an mdmon instance from /run, why not always start mdmon from there? -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html