lkml.org 
[lkml]   [2005]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patches in this message
/
Date
From
SubjectRe: [PATCH] Wait and retry mounting root device
Hi William,

William Park wrote:
> It's funny... Your patch does the opposite. It works for
> root=/dev/sda1
> from the kernel command line, but not from Lilo or 'root=8:1' on command
> line. :-)

Ah, yes :/

I found a simpler way to do it (but I'm not sure if it is 'clean' enough).
I've attached an incremental patch against your first patch. This works with
root=8:1 and root=/dev/sda1 for me.

Andrew, how does this look? I've also attached the new full patch so that you
can also see the context.

Thanks,
Daniel
Applies on top of William Park's wait/retry mounting root device patch.
Allows usage of "root=/dev/sda1" style arguments, which was not possible
in the first version.

Signed-off-by: Daniel Drake <dsd@gentoo.org>

--- linux-2.6.10/init/do_mounts.c 2005-01-05 01:03:47.165499144 +0000
+++ linux-dsd/init/do_mounts.c 2005-01-05 01:04:19.001659312 +0000
@@ -283,6 +283,10 @@

get_fs_names(fs_names);
retry:
+ if (!ROOT_DEV) {
+ ROOT_DEV = name_to_dev_t(saved_root_name);
+ create_dev(name, ROOT_DEV, root_device_name);
+ }
for (p = fs_names; *p; p += strlen(p)+1) {
int err = do_mount_root(name, p, flags, root_mount_data);
switch (err) {Retry up to 20 times if mounting the root device fails.
This fixes booting from usb-storage devices, which no longer
make their partitions immediately available.

From: William Park <opengeometry@yahoo.ca>
Signed-off-by: Daniel Drake <dsd@gentoo.org>

--- linux-2.6.10/init/do_mounts.c 2005-01-05 01:11:25.118879648 +0000
+++ linux-dsd/init/do_mounts.c 2005-01-05 01:04:19.001659312 +0000
@@ -6,6 +6,7 @@
#include <linux/suspend.h>
#include <linux/root_dev.h>
#include <linux/security.h>
+#include <linux/delay.h>

#include <linux/nfs_fs.h>
#include <linux/nfs_fs_sb.h>
@@ -278,9 +279,14 @@
char *fs_names = __getname();
char *p;
char b[BDEVNAME_SIZE];
+ int tryagain = 20;

get_fs_names(fs_names);
retry:
+ if (!ROOT_DEV) {
+ ROOT_DEV = name_to_dev_t(saved_root_name);
+ create_dev(name, ROOT_DEV, root_device_name);
+ }
for (p = fs_names; *p; p += strlen(p)+1) {
int err = do_mount_root(name, p, flags, root_mount_data);
switch (err) {
@@ -297,9 +303,13 @@
* and bad superblock on root device.
*/
__bdevname(ROOT_DEV, b);
- printk("VFS: Cannot open root device \"%s\" or %s\n",
- root_device_name, b);
- printk("Please append a correct \"root=\" boot option\n");
+ if (--tryagain) {
+ printk (KERN_WARNING "VFS: Waiting %dsec for root device...\n", tryagain);
+ ssleep (1);
+ goto retry;
+ }
+ printk (KERN_CRIT "VFS: Cannot open root device \"%s\" or %s\n", root_device_name, b);
+ printk (KERN_CRIT "Please append a correct \"root=\" boot option\n");

panic("VFS: Unable to mount root fs on %s", b);
}
\
 
 \ /
  Last update: 2005-03-22 14:09    [W:0.443 / U:0.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site