All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre Ossman <drzeus-list@drzeus.cx>
To: LKML <linux-kernel@vger.kernel.org>,
	Haavard Skinnemoen <hskinnemoen@atmel.com>
Subject: [RFC][PATCH] Make prepare_namespace() wait for devices
Date: Mon, 14 May 2007 14:19:37 +0200	[thread overview]
Message-ID: <464853D9.70904@drzeus.cx> (raw)

[-- Attachment #1: Type: text/plain, Size: 241 bytes --]

Testing and/or comments welcome.

-- 
     -- Pierre Ossman

  Linux kernel, MMC maintainer        http://www.kernel.org
  PulseAudio, core developer          http://pulseaudio.org
  rdesktop, core developer          http://www.rdesktop.org

[-- Attachment #2: initwait.patch --]
[-- Type: text/x-patch, Size: 1429 bytes --]

commit 7c542a5a027caa95bb00f8a8223c7e4aef88c931
Author: Pierre Ossman <drzeus@drzeus.cx>
Date:   Mon May 14 14:15:46 2007 +0200

    init: wait for asynchronously scanned block devices
    
    Some buses (e.g. USB and MMC) do their scanning of devices in the
    background, causing a race between them and prepare_namespace().
    In order to be able to use these buses without an initrd, we now
    wait for the device specified in root= to actually show up.
    
    If the device never shows up than we will hang in an infinite loop.
    Previously we panic:ed instead, so this behaviour should be no
    worse.
    
    Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

diff --git a/init/do_mounts.c b/init/do_mounts.c
index 46fe407..192b2d6 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -438,11 +438,24 @@ void __init prepare_namespace(void)
 			root_device_name += 5;
 	}
 
-	is_floppy = MAJOR(ROOT_DEV) == FLOPPY_MAJOR;
-
 	if (initrd_load())
 		goto out;
 
+	/* wait for any asynchronous scanning to complete */
+	if (ROOT_DEV == 0) {
+		printk("Waiting for root device %s...\n", saved_root_name);
+		do {
+			while (driver_probe_done() != 0)
+				msleep(100);
+			ROOT_DEV = name_to_dev_t(saved_root_name);
+			if (ROOT_DEV == 0)
+				msleep(100);
+		} while (ROOT_DEV == 0);
+	}
+
+	is_floppy = MAJOR(ROOT_DEV) == FLOPPY_MAJOR;
+
+
 	if (is_floppy && rd_doload && rd_load_disk(0))
 		ROOT_DEV = Root_RAM0;
 

             reply	other threads:[~2007-05-14 12:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-14 12:19 Pierre Ossman [this message]
2007-05-14 12:34 ` [RFC][PATCH] Make prepare_namespace() wait for devices Al Viro
2007-05-14 13:56   ` Pierre Ossman
2007-05-14 14:04     ` Haavard Skinnemoen
2007-05-14 15:18       ` [RFC][PATCH] Make prepare_namespace() wait for devices (v2) Pierre Ossman
2007-05-16  9:15         ` Haavard Skinnemoen
2007-05-16 12:31           ` Ben Nizette
2007-05-18 17:55 ` [RFC][PATCH] Make prepare_namespace() wait for devices Andi Kleen
2007-05-18 17:09   ` Pierre Ossman

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=464853D9.70904@drzeus.cx \
    --to=drzeus-list@drzeus.cx \
    --cc=hskinnemoen@atmel.com \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.