From: Pierre Ossman <drzeus-list@drzeus.cx>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Make prepare_namespace() wait for devices
Date: Fri, 01 Jun 2007 07:24:36 +0200 [thread overview]
Message-ID: <465FAD94.4020200@drzeus.cx> (raw)
In-Reply-To: <20070531085114.420b9cbe.akpm@linux-foundation.org>
[-- Attachment #1: Type: text/plain, Size: 614 bytes --]
Andrew Morton wrote:
> On Thu, 31 May 2007 13:20:48 +0200 Pierre Ossman <drzeus-list@drzeus.cx> wrote:
>
>> What was the verdict here? Were you satisfied with this or do you need a change?
>>
>
>
> I was kinda hoing to see version #2 with that funny loop cleaned up a bit?
>
>
New patch with the layout you suggested. It may be fewer lines, but I
still say my version was more readable.
Rgds
--
-- 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: 2047 bytes --]
commit 6354cb955ce1602b7b259f525edac7c8f585574b
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.
In order to not mess with setups that reboot on panic, the feature
must be turned on via the command line option "rootwait".
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
diff --git a/init/do_mounts.c b/init/do_mounts.c
index 46fe407..4e5ef6a 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -25,6 +25,7 @@ int __initdata rd_doload; /* 1 = load RAM disk, 0 = don't load */
int root_mountflags = MS_RDONLY | MS_SILENT;
char * __initdata root_device_name;
static char __initdata saved_root_name[64];
+int __initdata root_wait;
dev_t ROOT_DEV;
@@ -216,6 +217,14 @@ static int __init root_dev_setup(char *line)
__setup("root=", root_dev_setup);
+static int __init rootwait_setup(char *line)
+{
+ root_wait = simple_strtol(line,NULL,0);
+ return 1;
+}
+
+__setup("rootwait=", rootwait_setup);
+
static char * __initdata root_mount_data;
static int __init root_data_setup(char *str)
{
@@ -438,11 +447,20 @@ 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) && root_wait) {
+ printk(KERN_INFO "Waiting for root device %s...\n",
+ saved_root_name);
+ while (driver_probe_done() != 0 ||
+ (ROOT_DEV = name_to_dev_t(saved_root_name)) == 0)
+ msleep(100);
+ }
+
+ is_floppy = MAJOR(ROOT_DEV) == FLOPPY_MAJOR;
+
if (is_floppy && rd_doload && rd_load_disk(0))
ROOT_DEV = Root_RAM0;
next prev parent reply other threads:[~2007-06-01 5:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-24 12:21 [PATCH] Make prepare_namespace() wait for devices Pierre Ossman
2007-05-24 18:35 ` Olaf Hering
2007-05-24 20:46 ` Pierre Ossman
2007-05-25 0:06 ` Andrew Morton
2007-05-25 4:03 ` Pierre Ossman
2007-05-25 4:17 ` Andrew Morton
2007-05-25 4:31 ` Pierre Ossman
2007-05-31 11:20 ` Pierre Ossman
2007-05-31 15:51 ` Andrew Morton
2007-06-01 5:24 ` Pierre Ossman [this message]
2007-06-01 6:40 ` Andrew Morton
2007-06-01 6:51 ` 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=465FAD94.4020200@drzeus.cx \
--to=drzeus-list@drzeus.cx \
--cc=akpm@linux-foundation.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox