[systemd-devel] systemd kills mdmon if it was started manually by user
NeilBrown
neilb at suse.de
Sun Nov 6 18:52:41 PST 2011
On Wed, 2 Nov 2011 14:32:25 +0100 Lennart Poettering <lennart at poettering.net>
wrote:
> On Wed, 02.11.11 13:03, NeilBrown (neilb at suse.de) wrote:
> > Each instance of mdmon manages a set of arrays and must remain running
> > until all of those arrays are readonly (or shut down). This allows it to
> > record that all writes have completed and mark the array as 'clean' so a
> > resync isn't needed at next boot.
>
> Why doesn't the kernel do that on its own?
Because the kernel doesn't know about the format of the metadata that
describes the array.
> >
> > You couldn't just do the equivalent of
> > fuser -k /some/filesystem
> > umount /some/filesystem
> >
> > iterating over filesystems with '/' last?
> >
> > Then anything that only uses the /run filesystem will survive.
>
> What we do right now is this:
>
> kill_all_processes();
> do {
> umount_all_file_systems_we_can();
> read_only_mount_all_remaining_file_systems();
> } while (we_had_some_success_with_that());
> jump_into_initrd();
>
> As long as mdmon references a file from the root disk we cannot umount
> it, so the loop wouldn't be effective.
What exactly is "kill_all_processes()"? is it SIGTERM or SIGKILL or both
with a gap or ???
I assume a SIGKILL. I don't mind a SIGTERM and it could be useful to
expedite mdmon cleaning up.
However there is an important piece missing. When you remount,ro a
filesystem, the block device doesn't get told so it thinks it is still open
read/write. So md cannot tell mdmon that the array is now read-only
It would make a lot of sense for mdmon to exit after receiving a SIGTERM as
soon as the device is marked read-only. But it just doesn't know.
We can probably fix that, but that doesn't really help for now.
I think I would like:
- add to the above loop "stop any virtual devices that we can".
Exactly how to do that if /proc and /sys are already unmounted
is unclear. Is one or both of these kept around somewhere?
- allow processes to be marked some way so they get SIGTERM but not
SIGKILL. I'm happy adding magic char to argv[0].
We should be able to make it work with those changes - if they are possible.
Thanks,
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/20111107/6096e52a/attachment.pgp>
More information about the systemd-devel
mailing list