From: Lennart Poettering <lennart@poettering.net>
To: Andrey Borzenkov <arvidjaar@mail.ru>
Cc: linux-raid@vger.kernel.org, systemd-devel@lists.freedesktop.org
Subject: Re: systemd kills mdmon if it was started manually by user
Date: Tue, 8 Feb 2011 12:07:31 +0100 [thread overview]
Message-ID: <20110208110730.GF23157@tango.0pointer.de> (raw)
In-Reply-To: <AANLkTi=rFoqBwKdd0B3Xx6JrGdJdut0a2r=wFh0oSx73@mail.gmail.com>
On Tue, 08.02.11 13:52, Andrey Borzenkov (arvidjaar@mail.ru) wrote:
> I am probably the wrong one to ask, but here is what happens when
> array is started (from udev perspective)
[...]
> After this event device goes "plugged" and SYSTEMD_WANTS (if any) are
> triggered. But at this point we have zero information about array to
> decide anything.
[...]
> At this point we know it is container, know that it has external
> metadata and know that we need external metadata handler (mdmon). But
> it is too late for systemd.
Kay, do you know why this "change" event is used here? Any chance we can
get rid of it?
>
> >
> >> Actually it can be implemented even without mdadm patches; apparently
> >> it is possible to suppress normal starting of mdmon by setting
> >> MDADM_NO_MDMON=1
> >
> > A this point mdmon is simply broken: if glibc or mdmon itself (or any
> > lib it is using) is upgraded, then mdmon will keep referencing the old
> > .so or binary as long as it is running. This means that the fs these
> > files are on cannot be remounted r/o. However mdmon insists on being
> > shutdown only after all fs got remounted ro. So you have a cyclic
> > ordering loop here: mdmon wants to be shut down after the remount, but
> > we need to shut it down before the remount.
> >
>
> Ehh ...
>
> a) mdmon is perfectly capable of restarting, it is already used to
> take over mdmon launched in initrd. The problem is to know when to
> restart - i.e. when respective libraries are changed. This is a job
> for package management in distribution. It is already employed for
> glibc, systemd and some others and can just as well be employed for
> mdmon. And this is totally unrelated to systemd :)
Really, you are sying there is a synchronous way to make mdmon reexec
itself? How does that work?
> b) having binary launched off some fs should not prevent this fs to be
> remountd ro - binaries are not opened rw
If you run a binary and then the package manager replaces it then the
running instance will still refer to the old copy and this will have the
effect that the file isn't actually deleted until the proces
exits/execs. And because that is the way it is the kernel will refuse
unmounting of the fs until you terminated/reexeced your process.
> > This is unfixable unless a) mdmon learns reexecution of itself without
> > losing state (like most init systems so), or b) mdmon would stop
> > insisting on being shutdown only after the remount.
>
> As far as I can tell, both is true today; but remounting is not
> enough, unfortunately.
So, you are saying we can shut down mdmon without ill effects early?
> > In my eyes b) is very much preferebale: It should be possible to shut
> > down mdmon like any other service. And if then some md related code
> > still needs to be run on late shutdown this should be done from a new
> > process. I would be willing to add some hooks for this, so that we can
> > execute arbitrary drop-in processes as part of the final shutdown loop.
>
> mdmon is needed to ensure metadata were correctly updated. So it needs
> to exist as long as metadata *may* be updated. For practical purposes
> it means - until file system is unmounted and flushed to disks. I am
> not sure that remounting ro stops all activity (at least, mounting ro
> definitely *writes* to device using some filesystems).
Well, the root file systems cannot be unmounted, only remounted.
So, is there a way to invoke mdmon so that it flushes all metadata
changes to disk and immediately terminates then this should be all we
need for a clean solution. We'd then shutdown the normal instances of
mdmon down like any other daemon and simply invoke this metadata
flushing command as part of late shutdown.
Lennart
--
Lennart Poettering - Red Hat, Inc.
next prev parent reply other threads:[~2011-02-08 11:07 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-04 8:41 systemd kills mdmon if it was started manually by user Andrey Borzenkov
2010-12-04 9:12 ` Christian Parpart
2010-12-04 12:08 ` Andrey Borzenkov
2010-12-12 13:20 ` [systemd-devel] " Luca Berra
2011-01-07 0:40 ` Lennart Poettering
[not found] ` <20101204121413.GC11336@mother.pipebreaker.pl>
[not found] ` <AANLkTi=nTSdHc55f08G9sdEK6u8eXp276VOTHHr0jmXT@mail.gmail.com>
[not found] ` <20110125034434.GC7046@tango.0pointer.de>
[not found] ` <AANLkTik189VTXYpzLFqP=MNBg=Nx-Yq6BOKURtiby++B@mail.gmail.com>
[not found] ` <20110125042814.GA9727@tango.0pointer.de>
2011-02-04 19:55 ` Andrey Borzenkov
2011-02-08 9:48 ` [systemd-devel] " Lennart Poettering
2011-02-08 10:52 ` Andrey Borzenkov
2011-02-08 11:07 ` Lennart Poettering [this message]
2011-02-08 13:54 ` Andrey Borzenkov
2011-02-08 17:28 ` [systemd-devel] " Lennart Poettering
2011-10-23 8:00 ` Dan Williams
2011-10-24 8:04 ` Thomas Jarosch
2011-10-25 1:40 ` NeilBrown
2011-10-31 11:06 ` Lennart Poettering
2011-10-31 11:15 ` [systemd-devel] " Lennart Poettering
2011-11-02 0:44 ` NeilBrown
2011-11-02 1:16 ` Lennart Poettering
2011-11-02 2:03 ` NeilBrown
2011-11-02 13:32 ` Lennart Poettering
2011-11-02 14:33 ` Kay Sievers
2011-11-02 15:17 ` Lennart Poettering
2011-11-02 15:21 ` Kay Sievers
2011-11-02 15:29 ` [systemd-devel] " Lennart Poettering
2011-11-02 22:18 ` Williams, Dan J
2011-11-02 23:39 ` Lennart Poettering
2011-11-03 0:28 ` Williams, Dan J
2011-11-02 17:21 ` Williams, Dan J
2011-11-02 23:35 ` Lennart Poettering
2011-11-02 18:16 ` Williams, Dan J
2011-11-02 18:49 ` Kay Sievers
2011-11-02 19:31 ` Williams, Dan J
2011-11-02 19:51 ` Kay Sievers
2011-11-07 2:52 ` NeilBrown
2011-11-07 3:42 ` Kay Sievers
2011-11-07 4:30 ` NeilBrown
2011-11-07 12:00 ` Lennart Poettering
2011-11-07 19:09 ` Williams, Dan J
2011-11-08 14:43 ` Lennart Poettering
2011-11-08 23:27 ` Williams, Dan J
2011-11-08 0:11 ` Michal Soltys
2011-11-08 16:46 ` Michal Soltys
2011-11-08 20:32 ` Michal Soltys
2011-11-08 22:29 ` Williams, Dan J
2011-02-09 14:01 ` Lennart Poettering
2011-01-07 0:38 ` Lennart Poettering
2011-01-07 1:09 ` [systemd-devel] " Michael Biebl
2011-01-07 1:17 ` Roman Mamedov
2011-01-07 1:16 ` NeilBrown
2011-01-07 1:42 ` Lennart Poettering
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110208110730.GF23157@tango.0pointer.de \
--to=lennart@poettering.net \
--cc=arvidjaar@mail.ru \
--cc=linux-raid@vger.kernel.org \
--cc=systemd-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).