Bug 193206 - nash's stabilized command doesn't sleep as long as intended
Summary: nash's stabilized command doesn't sleep as long as intended
Alias: None
Product: Fedora
Classification: Fedora
Component: mkinitrd
Version: rawhide
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Peter Jones
QA Contact: David Lawrence
Depends On:
TreeView+ depends on / blocked
Reported: 2006-05-26 01:40 UTC by Alexandre Oliva
Modified: 2009-05-09 14:09 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2006-08-15 19:02:17 UTC
Type: ---

Attachments (Terms of Use)
Patch that fixes the bug (3.22 KB, patch)
2006-07-30 02:35 UTC, Alexandre Oliva
no flags Details | Diff

Description Alexandre Oliva 2006-05-26 01:40:47 UTC
Description of problem:
The sleep 8 that mkinitrd used to emit after usb-storage is no longer there,
which makes USB disks unusable for raid, lvm and others.  While putting it back
in, it might be nice to introduce it in such a way that it applies to both
usb-storage and sbp2, but the sleep is added after the last of the two if
they're both present.

Version-Release number of selected component (if applicable):

How reproducible:
Every time

Steps to Reproduce:
1.Add alias scsi_hostadapter usb-storage to /etc/modprobe.conf
2.Re-run mkinitrd

Actual results:
Note that it no longer waits 8 seconds for the USB bus to stabilize before it
brings up raid devices, volume groups et al

Expected results:
It should

Additional info:

Comment 1 Alexandre Oliva 2006-06-05 11:42:58 UTC
FWIW, this is not fixed yet in mkinitrd-5.0.41-3.  It looks like the delays in
stabilize are too short.  Adding an explicit --interval 1500 next to the
stabilize calls, then rebuilding mkinitrd, fixes it for me.

Comment 2 Chris Tyler 2006-06-06 21:11:09 UTC
I noticed today that having USB PVs in the VG that contains the root filesystem
... results in a system that won't boot (FC5). I presume that this bug report
covers that situation as well (?) but haven't make a custom initrd to verify.

Using an external USB drive as a PV in a pinch is a reasonable use case, but
this does not appear to be possible with the standard initrd.

Comment 3 Alexandre Oliva 2006-06-17 18:11:56 UTC
I still need --interval 1500 in the `stabilized' command lines for my external
disks to be brought up in time :-(

Comment 4 Alexandre Oliva 2006-07-03 23:06:32 UTC
It keeps getting worse :-(

I'm no longer sure the --interval is needed with mkinitrd-5.0.46-1, because the
multipath configuration now brought up by default stops raid auto-detection from
finding the raid 1 members in the USB disk, even if it is detected in time :-(

Comment 5 Alexandre Oliva 2006-07-16 16:50:25 UTC
stabilized is utterly broken on mkinitrd-5.0.47-1, it sleeps for hundreds of
seconds!  Just try:
echo stabilized / | strace nash 

Comment 6 Alexandre Oliva 2006-07-27 04:26:10 UTC
Still broken in 5.1.1-1 :-(

Comment 7 Alexandre Oliva 2006-07-28 20:51:13 UTC
<broken_record>Still broken in mkinitrd-5.1.2-1</broken_record> :-(

This small patch serves as a temporary work-around, but I can't even
install-test these systems with this feature broken :-(

--- /sbin/mkinitrd~     2006-07-26 15:43:41.000000000 -0300
+++ /sbin/mkinitrd      2006-07-28 17:45:50.000000000 -0300
@@ -1201 +1201 @@
-        emit "stabilized /proc/bus/usb/devices"
+        emit "stabilized --iterations 3 --interval 2 /proc/bus/usb/devices"
@@ -1205 +1205 @@
-        emit "stabilized /sys/bus/ieee1394/drivers/sbp2"
+        emit "stabilized --iterations 3 --interval 2

Comment 8 Alexandre Oliva 2006-07-30 02:35:01 UTC
Created attachment 133287 [details]
Patch that fixes the bug

The conversion from nanoseconds to microseconds was missing a division by 1000
in udelayspec().  It didn't make sense to convert to usecs just to have it
converted back to timespec in udelay(), and udelay() was doing too much work to
handle EINTR, so I just implemented udelayspec() as a simple loop and
re-implemented udelay() in terms of it, simplifying (and fixing the
off-by-one-usec/sec) the conversion to timespec while at that.

I fixed stabilizedCommand() similarly, and had to also fix stabilizedMtime to
actually use mtime consistently, instead of setting last to the atime and then
comparing it partially with mtime, partially with atime.  Without a limit on
iterations, that would never finish.

With this patch, stabilized appears to work.

Comment 9 Peter Jones 2006-08-15 19:02:17 UTC
Thanks, will be in 5.1.7 .

Note You need to log in before you can comment on or make changes to this bug.