Skip to contentSkip to conversation

rootfs on USB storage device

DISCUSSION Pete Zaitcev 2 participants 3 messages Nov 16, 2001 1 message not in the archive VFS

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

Does anybody have a clue as to what the USB bus has to do with /dev/console?

It's a timing issue, and has nothing to do with /dev/console. If you sit and spin before you try to mount the root fs, the USB subsystem will have enough time to find the drive. There's a few patches that do this in the lkml archives.

Quoted 7 lines
Quoted 1 line

greg k-h

It does not seem so. I included several seconds of mdelay() (and lots of printk()'s) while I was debugging, and that didnt change a thing. I added a.o. 4 seconds of mdelay() right before the open(), and 2 seconds right after the open() and the two dup()'s. The storage device was detected at the beginning of that last delay. [...]

I think khubd needs to run to complete whole process and mdelay() locks it out. You need something that calls schedule() for USB detection to work. Try to use schedule_timeout() instead of mdelay().

-- Pete

#2 lore raw
Quoted 3 lines · Pete Zaitcev

I think khubd needs to run to complete whole process and mdelay() locks it out. You need something that calls schedule() for USB detection to work. Try to use schedule_timeout() instead of mdelay().

This patch works for me.

Eric

fs/super.c renamed from fs/super.c.orig +6 -4
@@ -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);
#3 lore raw
In reply to Pete Zaitcev
Quoted 11 lines

Date: Fri, 16 Nov 2001 14:21:04 +0100 (CET)
From: Eric Lammerts <[email protected]>
To: Pete Zaitcev <[email protected]>
cc: [email protected], Greg KH <[email protected]>,
<[email protected]>

Quoted 3 lines

I think khubd needs to run to complete whole process and mdelay() locks it out. You need something that calls schedule() for USB detection to work. Try to use schedule_timeout() instead of mdelay().

This patch works for me.

Looks like a well done patch but what does happen if root= was indeed incorrect? I wish there was a way to print something meaningful for the operator.

-- Pete

P.S. - quoting the patch, saved for future reference

Quoted 20 lines
fs/super.c renamed from fs/super.c.orig +6 -4
@@ -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);