Re: fastboot/async and initramfs: How am I supposed to know when?devices are finished initializing?

From: Alexander Clouter
Date: Sun Mar 29 2009 - 16:08:42 EST


Thomas Bächler <thomas@xxxxxxxxxxxxx> wrote:
>
> Kay Sievers schrieb:
>> In initramfs, you have to wait until the device shows up, not for a
>> random module to initialize, or a bus to be scanned -- that can never
>> work correctly, it's pure luck, that your logic was always slower than
>> the kernel.
>>
>> You need a block device -- so you should just wait for the block
>> device, instead of making assumptions about initialization of drivers
>> or buses. :)
>
> I am planning to do that but there is one problem: Usually, the user
> specifies a root device, or a device that I want to open with
> cryptsetup, or anything similar and I can wait until it shows up.
>
> For lvm however, the user does not specify a specific block device that
> I can wait for, instead lvm scans all available block devices. Now, how
> do I know that the block device that contains my physical volume is
> already there? Maybe I have several hard drives, and several volume
> groups, so should I now call vgchange -ay again and again until the
> right volume group shows up?
>
If the user is specifying the boot device, could you not 'teach' them to
LABEL the boot device and live off something slightly more fancy (but
akin to) the following:

----
while true
do
mount LABEL=root /whatever

if [ $? -eq 0 ]; then
break
fi

# do some md and lvm magic dance here

sleep 1
done
----

Your initramfs could do extra steps everytime the loop...erm...loops.

Now of course the downside is LABELing mounted devices, XFS for example,
is not an easy thing to do... :-/

Cheers

--
Alexander Clouter
.sigmonster says: Am I ranting? I hope so. My ranting gets raves.

--
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/