s2disk / resume: Add grace period to allow resume device to come online

Original patch from Dominique Brazziel <dbrazziel@snet.net>
Tue, 12 Jun 2007 00:11:37 -0400 Original mail:

"I have an old system (eMachine 433MH) with a new external USB drive
(which is actually faster than the internal hard drive that came with
the box).  It takes a few seconds for the Linux to bring it online, due
in some part I think to a 5 second delay in kernel driver usb-storage
(specifically usb.c).  This console message gives a clue as to what is
happening:

usb-storage: waiting for device to settle before scanning

Once I installed uswsusp I noticed the boot process stopping because the
'stat' call only happens once (and fails), but almost immediately
afterward the drive would come online.

I worked up a patch that issues the stat call, sleeps for half a second
then checks again.  If it's successful it breaks out of the loop.  I set
the loop counter to 60 for a 30 second timeout.  It takes about 5 to 10
seconds for the drive to come online on my system but again, my system
is slow, mileage may vary."

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
1 file changed