linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [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

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).