[systemd-devel] systemd kills mdmon if it was started manually by user

Lennart Poettering lennart at poettering.net
Wed Nov 2 08:17:49 PDT 2011


On Wed, 02.11.11 15:33, Kay Sievers (kay.sievers at vrfy.org) 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.

c) make sure that mdmon run from the initrd is never upgrade during
normal operation, only via dracut rebuild and reboot.

If this is acceptable I am will cook up the patch for a).

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list