* [PATCH] mdadm: autodetect being run in an initramfs @ 2012-09-27 14:41 Dave Reisner 2012-09-27 22:07 ` Dmitrijs Ledkovs 2012-09-27 22:35 ` NeilBrown 0 siblings, 2 replies; 7+ messages in thread From: Dave Reisner @ 2012-09-27 14:41 UTC (permalink / raw) To: linux-raid; +Cc: teg, dreisner Key off of the existance of /etc/initrd-release as an indicator that mdadm is running in early userspace and set the __offroot flag. This allows the same udev-based assembly rules to be valid both off and on root and, moreover, will propagate to mdmon, should it need to be started. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- mdadm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mdadm.c b/mdadm.c index 4c7c5ea..557e00b 100644 --- a/mdadm.c +++ b/mdadm.c @@ -1106,6 +1106,11 @@ int main(int argc, char *argv[]) exit(0); } + /* auto-detect being on an initramfs + * http://www.freedesktop.org/wiki/Software/systemd/InitrdInterface */ + if (access("/etc/initrd-release", F_OK) == 0) + __offroot = 1; + if (!mode && devs_found) { mode = MISC; devmode = 'Q'; -- 1.7.12.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] mdadm: autodetect being run in an initramfs 2012-09-27 14:41 [PATCH] mdadm: autodetect being run in an initramfs Dave Reisner @ 2012-09-27 22:07 ` Dmitrijs Ledkovs [not found] ` <CA+mSPTgDnq8Xi+xCZte1WtORZhnV8S0=FXsm=wM0N1LfLpgtfQ@mail.gmail.com> 2012-09-27 22:35 ` NeilBrown 1 sibling, 1 reply; 7+ messages in thread From: Dmitrijs Ledkovs @ 2012-09-27 22:07 UTC (permalink / raw) To: Dave Reisner; +Cc: linux-raid, teg On 27 September 2012 15:41, Dave Reisner <dreisner@archlinux.org> wrote: > Key off of the existance of /etc/initrd-release as an indicator that > mdadm is running in early userspace and set the __offroot flag. This > allows the same udev-based assembly rules to be valid both off and on > root and, moreover, will propagate to mdmon, should it need to be > started. > And what shall non-systemd systems do? I don't have /etc/initrd-release in my initramfs-tools generated initrd, and so far didn't have a usecase for it. Should it be an empty file? > Signed-off-by: Dave Reisner <dreisner@archlinux.org> > --- > mdadm.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/mdadm.c b/mdadm.c > index 4c7c5ea..557e00b 100644 > --- a/mdadm.c > +++ b/mdadm.c > @@ -1106,6 +1106,11 @@ int main(int argc, char *argv[]) > exit(0); > } > > + /* auto-detect being on an initramfs > + * http://www.freedesktop.org/wiki/Software/systemd/InitrdInterface */ > + if (access("/etc/initrd-release", F_OK) == 0) > + __offroot = 1; > + > if (!mode && devs_found) { > mode = MISC; > devmode = 'Q'; > -- > 1.7.12.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-raid" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <CA+mSPTgDnq8Xi+xCZte1WtORZhnV8S0=FXsm=wM0N1LfLpgtfQ@mail.gmail.com>]
* Re: [PATCH] mdadm: autodetect being run in an initramfs [not found] ` <CA+mSPTgDnq8Xi+xCZte1WtORZhnV8S0=FXsm=wM0N1LfLpgtfQ@mail.gmail.com> @ 2012-09-27 22:29 ` Dmitrijs Ledkovs 2012-09-27 22:50 ` Dave Reisner 0 siblings, 1 reply; 7+ messages in thread From: Dmitrijs Ledkovs @ 2012-09-27 22:29 UTC (permalink / raw) To: Dave Reisner; +Cc: Tom Gundersen, Dave Reisner, linux-raid On 27 September 2012 23:11, Dave Reisner <d@falconindy.com> wrote: > > On Sep 27, 2012 6:08 PM, "Dmitrijs Ledkovs" <dmitrij.ledkov@surgut.co.uk> > wrote: >> >> On 27 September 2012 15:41, Dave Reisner <dreisner@archlinux.org> wrote: >> > Key off of the existance of /etc/initrd-release as an indicator that >> > mdadm is running in early userspace and set the __offroot flag. This >> > allows the same udev-based assembly rules to be valid both off and on >> > root and, moreover, will propagate to mdmon, should it need to be >> > started. >> > >> >> And what shall non-systemd systems do? > > Add the file, of course! > >> >> I don't have /etc/initrd-release in my initramfs-tools generated >> initrd, and so far didn't have a usecase for it. >> Should it be an empty file? >> > > Yep, just an empty file. It only serves to be a marker since there really > isn't any other heuristic for detecting early userspace. > This is a bit backwards. As far as I understand the systemd & udev merge now means that udev rules cannot spawn long running processes and instead should have a proper systemd units instead. And since systemd is running all of the initramfs surely it can set up an environment without adding pointless files, e.g. an environment variable? Please correct me, if I am wrong, cause I really don't understand either this patch or systemd or both. >> >> > Signed-off-by: Dave Reisner <dreisner@archlinux.org> >> > --- >> > mdadm.c | 5 +++++ >> > 1 file changed, 5 insertions(+) >> > >> > diff --git a/mdadm.c b/mdadm.c >> > index 4c7c5ea..557e00b 100644 >> > --- a/mdadm.c >> > +++ b/mdadm.c >> > @@ -1106,6 +1106,11 @@ int main(int argc, char *argv[]) >> > exit(0); >> > } >> > >> > + /* auto-detect being on an initramfs >> > + * >> > http://www.freedesktop.org/wiki/Software/systemd/InitrdInterface */ >> > + if (access("/etc/initrd-release", F_OK) == 0) >> > + __offroot = 1; >> > + >> > if (!mode && devs_found) { >> > mode = MISC; >> > devmode = 'Q'; >> > -- >> > 1.7.12.1 >> > >> > -- >> > To unsubscribe from this list: send the line "unsubscribe linux-raid" in >> > the body of a message to majordomo@vger.kernel.org >> > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mdadm: autodetect being run in an initramfs 2012-09-27 22:29 ` Dmitrijs Ledkovs @ 2012-09-27 22:50 ` Dave Reisner 0 siblings, 0 replies; 7+ messages in thread From: Dave Reisner @ 2012-09-27 22:50 UTC (permalink / raw) To: Dmitrijs Ledkovs; +Cc: Tom Gundersen, Dave Reisner, linux-raid On Thu, Sep 27, 2012 at 11:29:48PM +0100, Dmitrijs Ledkovs wrote: > On 27 September 2012 23:11, Dave Reisner <d@falconindy.com> wrote: > > > > On Sep 27, 2012 6:08 PM, "Dmitrijs Ledkovs" <dmitrij.ledkov@surgut.co.uk> > > wrote: > >> > >> On 27 September 2012 15:41, Dave Reisner <dreisner@archlinux.org> wrote: > >> > Key off of the existance of /etc/initrd-release as an indicator that > >> > mdadm is running in early userspace and set the __offroot flag. This > >> > allows the same udev-based assembly rules to be valid both off and on > >> > root and, moreover, will propagate to mdmon, should it need to be > >> > started. > >> > > >> > >> And what shall non-systemd systems do? > > > > Add the file, of course! > > > >> > >> I don't have /etc/initrd-release in my initramfs-tools generated > >> initrd, and so far didn't have a usecase for it. > >> Should it be an empty file? > >> > > > > Yep, just an empty file. It only serves to be a marker since there really > > isn't any other heuristic for detecting early userspace. > > > > This is a bit backwards. As far as I understand the systemd & udev > merge now means that udev rules cannot spawn long running processes > and instead should have a proper systemd units instead. udev rules were never allowed to spawn long running processes. The merger means nothing in this regard. The only point of this patch is to ensure that mdmon is spawned via mdadm with the correct --offroot flag so that it isn't mercilessly slaughtered later on. This auto-spawn behavior happens today, but without the --offroot flag. > And since systemd is running all of the initramfs surely it can set up > an environment without adding pointless files, e.g. an environment > variable? How would such an environment variable be set? Not everyone runs systemd in early userspace. To my knowledge, only Fedora does this currently. However, everyone can only benefit from this marker file in their initramfs. For those not running systemd at all, the presence of this file has no perceivable effect. > Please correct me, if I am wrong, cause I really don't understand > either this patch or systemd or both. > > > >> > >> > Signed-off-by: Dave Reisner <dreisner@archlinux.org> > >> > --- > >> > mdadm.c | 5 +++++ > >> > 1 file changed, 5 insertions(+) > >> > > >> > diff --git a/mdadm.c b/mdadm.c > >> > index 4c7c5ea..557e00b 100644 > >> > --- a/mdadm.c > >> > +++ b/mdadm.c > >> > @@ -1106,6 +1106,11 @@ int main(int argc, char *argv[]) > >> > exit(0); > >> > } > >> > > >> > + /* auto-detect being on an initramfs > >> > + * > >> > http://www.freedesktop.org/wiki/Software/systemd/InitrdInterface */ > >> > + if (access("/etc/initrd-release", F_OK) == 0) > >> > + __offroot = 1; > >> > + > >> > if (!mode && devs_found) { > >> > mode = MISC; > >> > devmode = 'Q'; > >> > -- > >> > 1.7.12.1 > >> > > >> > -- > >> > To unsubscribe from this list: send the line "unsubscribe linux-raid" in > >> > the body of a message to majordomo@vger.kernel.org > >> > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mdadm: autodetect being run in an initramfs 2012-09-27 14:41 [PATCH] mdadm: autodetect being run in an initramfs Dave Reisner 2012-09-27 22:07 ` Dmitrijs Ledkovs @ 2012-09-27 22:35 ` NeilBrown 2012-09-27 22:53 ` Dave Reisner 1 sibling, 1 reply; 7+ messages in thread From: NeilBrown @ 2012-09-27 22:35 UTC (permalink / raw) To: Dave Reisner; +Cc: linux-raid, teg [-- Attachment #1: Type: text/plain, Size: 1176 bytes --] On Thu, 27 Sep 2012 10:41:03 -0400 Dave Reisner <dreisner@archlinux.org> wrote: > Key off of the existance of /etc/initrd-release as an indicator that > mdadm is running in early userspace and set the __offroot flag. This > allows the same udev-based assembly rules to be valid both off and on > root and, moreover, will propagate to mdmon, should it need to be > started. > > Signed-off-by: Dave Reisner <dreisner@archlinux.org> > --- > mdadm.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/mdadm.c b/mdadm.c > index 4c7c5ea..557e00b 100644 > --- a/mdadm.c > +++ b/mdadm.c > @@ -1106,6 +1106,11 @@ int main(int argc, char *argv[]) > exit(0); > } > > + /* auto-detect being on an initramfs > + * http://www.freedesktop.org/wiki/Software/systemd/InitrdInterface */ > + if (access("/etc/initrd-release", F_OK) == 0) > + __offroot = 1; > + > if (!mode && devs_found) { > mode = MISC; > devmode = 'Q'; What is the problem with adding the --offroot flag to every place in the initrd that starts mdadm? (Actually I'm contemplating making --offroot the default so this might become a non-issue) NeilBrown [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 828 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mdadm: autodetect being run in an initramfs 2012-09-27 22:35 ` NeilBrown @ 2012-09-27 22:53 ` Dave Reisner 2012-09-27 23:18 ` NeilBrown 0 siblings, 1 reply; 7+ messages in thread From: Dave Reisner @ 2012-09-27 22:53 UTC (permalink / raw) To: NeilBrown; +Cc: Dave Reisner, linux-raid, teg On Fri, Sep 28, 2012 at 08:35:18AM +1000, NeilBrown wrote: > On Thu, 27 Sep 2012 10:41:03 -0400 Dave Reisner <dreisner@archlinux.org> > wrote: > > > Key off of the existance of /etc/initrd-release as an indicator that > > mdadm is running in early userspace and set the __offroot flag. This > > allows the same udev-based assembly rules to be valid both off and on > > root and, moreover, will propagate to mdmon, should it need to be > > started. > > > > Signed-off-by: Dave Reisner <dreisner@archlinux.org> > > --- > > mdadm.c | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/mdadm.c b/mdadm.c > > index 4c7c5ea..557e00b 100644 > > --- a/mdadm.c > > +++ b/mdadm.c > > @@ -1106,6 +1106,11 @@ int main(int argc, char *argv[]) > > exit(0); > > } > > > > + /* auto-detect being on an initramfs > > + * http://www.freedesktop.org/wiki/Software/systemd/InitrdInterface */ > > + if (access("/etc/initrd-release", F_OK) == 0) > > + __offroot = 1; > > + > > if (!mode && devs_found) { > > mode = MISC; > > devmode = 'Q'; > > What is the problem with adding the --offroot flag to every place in the > initrd that starts mdadm? The assumption is that mdadm is being called via udev for assembly, so we'd need to maintain a separate udev rule explicitly for the initramfs. I'd rather not do that. > (Actually I'm contemplating making --offroot the default so this might become > a non-issue) That'd be great! ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mdadm: autodetect being run in an initramfs 2012-09-27 22:53 ` Dave Reisner @ 2012-09-27 23:18 ` NeilBrown 0 siblings, 0 replies; 7+ messages in thread From: NeilBrown @ 2012-09-27 23:18 UTC (permalink / raw) To: Dave Reisner; +Cc: Dave Reisner, linux-raid, teg [-- Attachment #1: Type: text/plain, Size: 1759 bytes --] On Thu, 27 Sep 2012 18:53:02 -0400 Dave Reisner <d@falconindy.com> wrote: > On Fri, Sep 28, 2012 at 08:35:18AM +1000, NeilBrown wrote: > > On Thu, 27 Sep 2012 10:41:03 -0400 Dave Reisner <dreisner@archlinux.org> > > wrote: > > > > > Key off of the existance of /etc/initrd-release as an indicator that > > > mdadm is running in early userspace and set the __offroot flag. This > > > allows the same udev-based assembly rules to be valid both off and on > > > root and, moreover, will propagate to mdmon, should it need to be > > > started. > > > > > > Signed-off-by: Dave Reisner <dreisner@archlinux.org> > > > --- > > > mdadm.c | 5 +++++ > > > 1 file changed, 5 insertions(+) > > > > > > diff --git a/mdadm.c b/mdadm.c > > > index 4c7c5ea..557e00b 100644 > > > --- a/mdadm.c > > > +++ b/mdadm.c > > > @@ -1106,6 +1106,11 @@ int main(int argc, char *argv[]) > > > exit(0); > > > } > > > > > > + /* auto-detect being on an initramfs > > > + * http://www.freedesktop.org/wiki/Software/systemd/InitrdInterface */ > > > + if (access("/etc/initrd-release", F_OK) == 0) > > > + __offroot = 1; > > > + > > > if (!mode && devs_found) { > > > mode = MISC; > > > devmode = 'Q'; > > > > What is the problem with adding the --offroot flag to every place in the > > initrd that starts mdadm? > > The assumption is that mdadm is being called via udev for assembly, so > we'd need to maintain a separate udev rule explicitly for the initramfs. > I'd rather not do that. Then use --offroot for the 'standard' udev rules too. > > > (Actually I'm contemplating making --offroot the default so this might become > > a non-issue) > > That'd be great! Your support is noted - thanks :-) NeilBrown [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 828 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-09-27 23:18 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-09-27 14:41 [PATCH] mdadm: autodetect being run in an initramfs Dave Reisner 2012-09-27 22:07 ` Dmitrijs Ledkovs [not found] ` <CA+mSPTgDnq8Xi+xCZte1WtORZhnV8S0=FXsm=wM0N1LfLpgtfQ@mail.gmail.com> 2012-09-27 22:29 ` Dmitrijs Ledkovs 2012-09-27 22:50 ` Dave Reisner 2012-09-27 22:35 ` NeilBrown 2012-09-27 22:53 ` Dave Reisner 2012-09-27 23:18 ` NeilBrown
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).