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

NeilBrown neilb at suse.de
Tue Nov 1 17:44:16 PDT 2011


On Mon, 31 Oct 2011 12:06:13 +0100 Lennart Poettering
<lennart at poettering.net> wrote:

> On Sun, 23.10.11 01:00, Dan Williams (dan.j.williams at intel.com) wrote:
> 
> > > Well, it would be nice if the md utils would offer something doing this
> > > without spawning multiple processes and killing them again.
> > >
> > 
> > /me wonders why his raid5 resyncs every boot on Fedora 15 and has
> > found this old thread.
> > 
> > I'm tempted to:
> > 
> > 1/ teach ignore_proc() to scan for pid files in /dev/md/ (MDMON_DIR on
> > Fedora)
> 
> This will not help you.
> 
> We nowadays jump back into the initrd when we shut down, so that the
> initrd disassembles everything it assembled at boot time. This for the
> first time enables us to ensure that all layers of our stack are in a
> sane state (i.e. fully offline) when we shut down, regardless in which
> way you stack it.

This sounds particularly elegant.
Is there some part of the filesystem, that survives through the whole process
- from before / is mounted until after it is unmounted?
Presumably this would be /run if anything.

mdmon must be running from the time that / becomes writable until after it
becomes readonly.
If we can have it from before it is mounted until after it is unmounted, that
might be even better.
(It is possible to start a new one which replaces the old one but if that was
only used for version upgrades, that would be best).

So if mdmon has a 'cwd' and all open files in /run (and the executable
elsewhere in the same filesystem), could it easily survive the 'kill all
processes before unmounting /' thing?

> 
> However, just excluding mdmom from being killed will not make this work,
> simply because jumping into initrd only works sensibly if we can drop
> all references to all previous mounts which requires us to have only one
> process running at that time, and one process only.
> 
> It always boils down to the same thing: mdmon must be something we can
> shutdown cleanly like every other process. Excluding it from that will
> just move the problem around, but not fix it.

My ideal would be that you just ignore mdmon.
After unmounting '/', you shutdown md arrays with "mdadm -Ss" and then mdmon
will spontaneously disappear.


> 
> > 2/ arrange for mdadm --wait-clean --scan to be called after all
> > filesytems have been mounted read only
> 
> Won't help you really either, since we have to kill all processes before
> we jump into the initrd to fully disassemble mounts and storage.
> 
> There'll always be this chicken and egg problem: we cannot disassmble
> all storage until all processes are gone and we are back in the
> initrd. But mdmon wants to stay running after we 
> 
> > ...but a few things strike me.  This does not seem to be what was
> > being proposed above.  Systemd does not treat dm devices like a
> > service and takes care to shut them down explicitly (but in that case
> > there is an api that it can call).  Is it time for a libmd.so,  so
> > systemd can invoke the "--wait-clean --scan" process itself?  Probably
> > simpler to just SIGTERM mdmon and wait for it.
> 
> We actually try to disassemble md already, i.e. we call the
> DM_DEV_REMOVE ioctl for all left-over devices. I am not really
> interested to link against libdm itself.

:-)
I get used to this .. people confusing md and dm, people confusing nfs-client
with nfs-server, people confusing me with some other Mr Brown :-)

NeilBrown

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20111102/79be97c3/attachment.pgp>


More information about the systemd-devel mailing list