Re: [RFC/PATCH] usb-storage: wait for device scanning before mounting root

From: Matthew Dharm
Date: Thu Apr 24 2008 - 19:31:33 EST


On Thu, Apr 24, 2008 at 03:56:04PM -0700, Greg KH wrote:
> On Fri, Apr 25, 2008 at 12:25:04AM +0300, Pekka J Enberg wrote:
> > On Thu, 24 Apr 2008, Pekka J Enberg wrote:
> > > > From: Pekka Enberg <penberg@xxxxxxxxxxxxxx>
> > > >
> > > > Add a new kernel config option CONFIG_LATE_ROOT_MOUNT that makes the kernel
> > > > wait until background scanning of USB mass storage devices is complete before
> > > > attempting to mount the root filesystem.
> > > >
> > > > The config option is an alternative to the root_delay= kernel parameter
> > > > solution people currently use to boot from USB mass storage devices.
> >
> > On Thu, 24 Apr 2008, Alan Stern wrote:
> > > This doesn't take into account what happens when CONFIG_SCSI_SCAN_ASYNC
> > > is set.
> >
> > Oh, right. Thanks! So something like the following should take care of it.
> >
> > Pekka
> >
> > Subject: [RFC/PATCH] usb-storage: wait for device scanning before mounting root V2
> > From: Pekka Enberg <penberg@xxxxxxxxxxxxxx>
> >
> > Add a new kernel config option CONFIG_LATE_ROOT_MOUNT that makes the kernel
> > wait until background scanning of USB mass storage devices is complete before
> > attempting to mount the root filesystem.
>
> What happens if there is no USB device present in the system? Because
> of that, there is no way that this option could ever be enabled by any
> distro or anyone wanting their kernel to run on more than one machine :(
>
> I don't like it.

This also has all sorts of races between do_mounts 'waiting' and the actual
USB device enumeration. It's entirely possible that the kernel loads via
BIOS, the USB drivers are loaded, that forces devices to disconnect/reset,
and they take a while to re-enumerate. During that delay, the kernel gets
to do_mount; now, no devices show in this "waiting for scan" count.

The right way to do this is via initrd and something like devlabel to wait
for a specific device to appear. On some systems, you may want to wait for
several devices to appear.

I don't like this either.

Matt

--
Matthew Dharm Home: mdharm-usb@xxxxxxxxxxxxxxxxxx
Maintainer, Linux USB Mass Storage Driver

What, are you one of those Microsoft-bashing Linux freaks?
-- Customer to Greg
User Friendly, 2/10/1999

Attachment: pgp00000.pgp
Description: PGP signature