mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* patch to have root fs on USB device (please CC)
@ 2002-06-02 20:13 Paul Stoeber
  2002-06-02 20:46 ` Thunder from the hill
  2002-06-03 15:05 ` Eric Lammerts
  0 siblings, 2 replies; 3+ messages in thread
From: Paul Stoeber @ 2002-06-02 20:13 UTC (permalink / raw)
  To: linux-kernel

It simply sleeps 10 seconds before mount_block_root().

I get an 'Unable to mount root' panic if I don't apply it,
because the attached device rolls in too late.

Same for FireWire, but that's currently out of reach because
I must run rescan-scsi-bus.sh from user space to make the
disk visible as /dev/sd?  (to be fixed soon??).

Same for all hotpluggable storage devices I suppose.

Of course that patch is really terribly wrong, maybe someone
will fix these things some day.

Please CC, I'm not on the list.


wait-before-mounting-root.patch in
Linux xyz 2.4.19-pre8 #2 Sun May 26 20:02:49 UTC 2002 ppc unknown

--- init/do_mounts.c.orig	Sat May 25 18:11:45 2002
+++ init/do_mounts.c	Sat May 25 18:15:22 2002
@@ -311,9 +311,13 @@
 }
 static void __init mount_block_root(char *name, int flags)
 {
-	char *fs_names = __getname();
+	char *fs_names;
 	char *p;
 
+	set_current_state(TASK_UNINTERRUPTIBLE);
+	schedule_timeout(10*HZ);
+
+	fs_names = __getname();
 	get_fs_names(fs_names);
 retry:
 	for (p = fs_names; *p; p += strlen(p)+1) {

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: patch to have root fs on USB device (please CC)
  2002-06-02 20:13 patch to have root fs on USB device (please CC) Paul Stoeber
@ 2002-06-02 20:46 ` Thunder from the hill
  2002-06-03 15:05 ` Eric Lammerts
  1 sibling, 0 replies; 3+ messages in thread
From: Thunder from the hill @ 2002-06-02 20:46 UTC (permalink / raw)
  To: Paul Stoeber; +Cc: linux-kernel

Hi,

On Sun, 2 Jun 2002, Paul Stoeber wrote:
> --- init/do_mounts.c.orig	Sat May 25 18:11:45 2002
> +++ init/do_mounts.c	Sat May 25 18:15:22 2002
> @@ -311,9 +311,13 @@
>  }
>  static void __init mount_block_root(char *name, int flags)
>  {
> -	char *fs_names = __getname();
> +	char *fs_names;
>  	char *p;
>  
> +	set_current_state(TASK_UNINTERRUPTIBLE);
> +	schedule_timeout(10*HZ);
> +
> +	fs_names = __getname();
>  	get_fs_names(fs_names);
>  retry:
>  	for (p = fs_names; *p; p += strlen(p)+1) {

I think we shouldn't bind it on time but rather on whether the device is 
available. Maybe check that instead of schedule_timeout(10*HZ)?

BTW, we stay in TASK_UNINTERRUPTIBLE here!

+       int i;
+
+       if (!(flags & SOMETHING_SAYING_WE_SHALL_NOT_INTERRUPT)) {
+           while (!path_lookup(name, LOOKUP_FOLLOW, &dummy)) {
+               i++;
+               printk(KERN_NOTICE "Root FS not yet available!\n");
+               if (i > 10)
+                   break;
+
+               schedule_timeout(HZ/2);
+           }
+       }

or whatever.

Regards,
Thunder
-- 
ship is leaving right on time	|	Thunder from the hill at ngforever
empty harbour, wave goodbye	|
evacuation of the isle		|	free inhabitant not directly
caveman's paintings drowning	|	belonging anywhere



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: patch to have root fs on USB device (please CC)
  2002-06-02 20:13 patch to have root fs on USB device (please CC) Paul Stoeber
  2002-06-02 20:46 ` Thunder from the hill
@ 2002-06-03 15:05 ` Eric Lammerts
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Lammerts @ 2002-06-03 15:05 UTC (permalink / raw)
  To: Paul Stoeber; +Cc: linux-kernel


On Sun, Jun 02, 2002 at 10:13:22PM +0200, Paul Stoeber wrote:
> It simply sleeps 10 seconds before mount_block_root().
> 
> I get an 'Unable to mount root' panic if I don't apply it,
> because the attached device rolls in too late.

A while ago I made the patch below. I retries every second until the root
device appears. Advantages:
- no delay when the device is already there
- it also works if it takes longer than 10s to find the harddisk
  (for example, if you plug it in later)

I don't know if it applies cleanly to current kernels.

Eric

--- linux-2.4.14-pre8-ext3/fs/super.c.orig	Fri Nov 16 00:59:18 2001
+++ linux-2.4.14-pre8-ext3/fs/super.c	Fri Nov 16 01:07:26 2001
@@ -1009,11 +1009,13 @@
 		 * Allow the user to distinguish between failed open
 		 * and bad superblock on root device.
 		 */
-		printk ("VFS: Cannot open root device \"%s\" or %s\n",
+		printk ("VFS: Cannot open root device \"%s\" or %s, retrying in 1s.\n",
 			root_device_name, kdevname (ROOT_DEV));
-		printk ("Please append a correct \"root=\" boot option\n");
-		panic("VFS: Unable to mount root fs on %s",
-			kdevname(ROOT_DEV));
+
+		/* wait 1 second and try again */
+		current->state = TASK_INTERRUPTIBLE;
+		schedule_timeout(HZ);
+		goto retry;
 	}
 
 	check_disk_change(ROOT_DEV);

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-06-03 15:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-02 20:13 patch to have root fs on USB device (please CC) Paul Stoeber
2002-06-02 20:46 ` Thunder from the hill
2002-06-03 15:05 ` Eric Lammerts

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®