Re: [PATCH] Wait and retry mounting root device (revised)

From: Helge Hafting
Date: Tue Jan 18 2005 - 03:22:32 EST


Randy.Dunlap wrote:

Al Viro wrote:

On Tue, Jan 18, 2005 at 02:54:24AM +0000, Daniel Drake wrote:

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.



Sigh... So we can very well get device coming up in the middle of a loop
and get the actual attempts to mount the sucker in wrong order. How nice...

Folks, that's not a solution. And kludges like that really have no
business being there - they only hide the problem and make it harder
to reproduce.


Is there a solution other than initrd/initramfs ?

There is a solution that seems obvious to me, so obvious that it ought to
be the first solution to try. And it is guaranteed to not mess up raid or anything
else too. So perhaps there is something wrong with it, or someone would have done this
already? Here it is:

Apparently, USB devices doesn't appear immediately (after powerup? after
USB bus initialization?) We know this - therefore the USB block driver should know this.
The USB block driver should know that 10s (or whatever) hasn't yet passed, and simply
block any attempt to access block devices (or scan for them) knowing that it will
not work yet, but any device will be there after the pause. A root mount on USB will
then succeed at the _first_ try everytime, so no need for retries.

This solution is guaranteed to not mess up raid or anything else, because the fix is done
in the driver for the "odd" devices, not in the upper layer trying to use the device as a
root fs.

Surely someone must have thought of this before - is there any reason why this
won't work well?

The only thing I can think of is that partition scanning will cause a delay
on every system with USB block devices compiled-in, but this could be
postponed when root isn't on usb.
Partition scanning is moving to "early userspace" anyway, isn't it? In the meantime,
people without USB root that don't want a bootup delay can use modular usb and load
the module later in some boot script.

Helge Hafting
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/