mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jesper Juhl <juhl-lkml@dif.dk>
To: William Park <opengeometry@yahoo.ca>
Cc: Marcelo Tosatti <marcelo.tosatti@cyclades.com>,
	linux-kernel@vger.kernel.org, Jesper Juhl <juhl-lkml@dif.dk>,
	Andrew Morton <akpm@osdl.org>
Subject: Re: waiting 10s before mounting root filesystem?
Date: Fri, 31 Dec 2004 02:45:53 +0100 (CET)	[thread overview]
Message-ID: <Pine.LNX.4.61.0412310234040.4725@dragon.hygekrogen.localhost> (raw)
In-Reply-To: <Pine.LNX.4.61.0412310011400.3494@dragon.hygekrogen.localhost>

William Park wrote:
> On Thu, Dec 30, 2004 at 01:25:32PM -0200, Marcelo Tosatti wrote:
> > On Tue, Dec 28, 2004 at 07:59:22PM -0500, William Park wrote:
> > > On Mon, Dec 27, 2004 at 10:23:34PM +0100, Andreas Unterkircher wrote:
> > > > [1] http://www.xenotime.net/linux/usb/usbboot-2422.patch
> > > 
> > > Thanks Andreas.  I can now boot from my el-cheapo USB key drive
> > > (256MB SanDisk Cruzer Mini).  Since mine takes about 5sec to show
> > > up, I decided to wait 5sec instead of 1sec.  Here is diff for
> > > 2.6.10:
> > > 
> > > --- ./init/do_mounts.c--orig	2004-12-27 17:36:35.000000000 -0500
> > > +++ ./init/do_mounts.c	2004-12-28 17:27:26.000000000 -0500
> > > @@ -301,7 +301,14 @@ retry:
> > >  				root_device_name, b);
> > >  		printk("Please append a correct \"root=\" boot option\n");
> > > 
> > > +#if 0	/* original code */
> > >  		panic("VFS: Unable to mount root fs on %s", b);
> > > +#else
> > > +		printk ("Waiting 5 seconds to try again...\n");
> > > +		set_current_state(TASK_INTERRUPTIBLE);
> > > +		schedule_timeout(5 * HZ);
> > > +		goto retry;
> > > +#endif
> > >  	}
> > >  	panic("VFS: Unable to mount root fs on %s", __bdevname(ROOT_DEV, b));
> > >  out:
> > 
> > William,
> > 
> > Solar version which is now merged in v2.4 looks better (5s sleep is
> > too long and only one try) IMO.
> > 
> > It sleeps 1s each time, 10 times. More reliable and faster.
> > 
> > 
> http://linux.bkbits.net:8080/linux-2.4/patch@1.1527.1.20?nav=index.html|ChangeSet@-3w|cset@1.1527.1.20 
> 
> Hi Marcelo,
> 
> 1.  Actually, my patch above loops every 5s to reduce screen clutter,
>     whereas the original 2.4 patch (cited by Andreas Unterkircher) loops
>     every 1s.  Both loops forever.
> 
>     But, if a limit of 10 tries is what you want, then here is a patch
>     for 2.6.10:

I agree with you that reducing screen clutter is a good thing. How about 
something like this that waits for 10+ seconds so even slow devices have a 
chance to get up but also does some primitive ratelimiting on the messages 
by only printing one every 3 seconds (but still attempting to mount every 
1 sec) ? 

This is a small variation on the patch I posted a little while ago.

Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>

diff -up linux-2.6.10-bk2-orig/init/do_mounts.c linux-2.6.10-bk2/init/do_mounts.c
--- linux-2.6.10-bk2-orig/init/do_mounts.c	2004-12-24 22:34:31.000000000 +0100
+++ linux-2.6.10-bk2/init/do_mounts.c	2004-12-31 02:44:13.000000000 +0100
@@ -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,6 +279,7 @@ void __init mount_block_root(char *name,
 	char *fs_names = __getname();
 	char *p;
 	char b[BDEVNAME_SIZE];
+	short retries = 15;
 
 	get_fs_names(fs_names);
 retry:
@@ -297,9 +299,17 @@ retry:
 		 * and bad superblock on root device.
 		 */
 		__bdevname(ROOT_DEV, b);
-		printk("VFS: Cannot open root device \"%s\" or %s\n",
+		if (retries--) {
+			if (retries % 3 == 0)
+				printk(KERN_WARNING "VFS: Cannot open root device "
+					"\"%s\" or %s, retrying in 1s.\n",
+					root_device_name, b);
+			ssleep(1);
+			goto retry;
+		}
+		printk(KERN_CRIT "VFS: Cannot open root device \"%s\" or %s, giving up.\n",
 				root_device_name, b);
-		printk("Please append a correct \"root=\" boot option\n");
+		printk(KERN_CRIT "Please append a correct \"root=\" boot option\n");
 
 		panic("VFS: Unable to mount root fs on %s", b);
 	}



> 
> 2.  I sincerely hope that this patch get included in the main kernel.
>     USB boot is very important feature, and will become the standard way
>     of booting Linux thin-client as well as other Linux system, embedded
>     or not.  It will make Netboot, Etherboot, PXE boot, CF-to-IDE
>     adapter, and initrd all obsolete.
> 
I agree, some version of this should go into 2.6. If we can successfully 
get the system up and running by retrying the root fs mount a few times 
then that's a lot better than panicking :)


-- 
Jesper Juhl


PS. Sorry if I messed up the thread a bit, but I had some mailserver 
trouble and lost a few LKML mails so I couldn't reply directly to the 
proper mail.

  reply	other threads:[~2004-12-31  1:34 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-27 19:56 William Park
2004-12-27 20:10 ` Trent Lloyd
2004-12-27 21:23   ` Andreas Unterkircher
2004-12-28  1:54     ` Eric Lammerts
2004-12-29  0:59     ` William Park
2004-12-29  1:38       ` Jesper Juhl
2004-12-29  1:56         ` William Park
2004-12-29 12:49           ` Paulo Marques
2004-12-29 19:15             ` William Park
2004-12-29 19:34               ` Paulo Marques
2004-12-29 20:59                 ` William Park
2004-12-29 21:26                   ` Andreas Steinmetz
2004-12-31 19:32                     ` Willy Tarreau
2004-12-29 21:53                   ` Bernd Eckenfels
2004-12-29 22:56                 ` Jesper Juhl
2004-12-30 15:25       ` Marcelo Tosatti
2004-12-30 23:45         ` Jesper Juhl
2004-12-31  1:45           ` Jesper Juhl [this message]
2004-12-31  3:58             ` William Park
2004-12-31  4:41               ` Jesper Juhl
2004-12-31 11:31                 ` Paulo Marques
2004-12-31  9:49               ` Andrew Morton
2004-12-31  8:28                 ` Marcelo Tosatti
2004-12-31 11:40                   ` Andrew Morton
2004-12-31 11:26                 ` Paulo Marques
2004-12-31  8:58                   ` Marcelo Tosatti
2004-12-31 11:42                   ` Andrew Morton
2004-12-31 12:04                     ` Paulo Marques
2004-12-31 17:36                     ` William Park
2004-12-31 17:48                       ` Tomasz Torcz
2004-12-31 18:18                         ` William Park
2004-12-31  0:22         ` William Park
     [not found] <fa.nc4oh06.1j1872e@ifi.uio.no>
     [not found] ` <fa.nalafoa.1ih25aa@ifi.uio.no>
2004-12-31 12:33   ` Bodo Eggert

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=Pine.LNX.4.61.0412310234040.4725@dragon.hygekrogen.localhost \
    --to=juhl-lkml@dif.dk \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.tosatti@cyclades.com \
    --cc=opengeometry@yahoo.ca \
    /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

all inboxes | Powered by JetHome®