]> git.baikalelectronics.ru Git - kernel.git/commit
usb_storage: Don't freeze in usb-stor-scan
authorSeth Forshee <seth.forshee@canonical.com>
Tue, 26 Jul 2011 14:56:07 +0000 (09:56 -0500)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 22 Aug 2011 22:21:15 +0000 (15:21 -0700)
commit4ef1cdf0596540c9ed53a3fe6c063d334f1a9fd1
treef4d02d390dc50bb9badb2a7f45526ec705153f04
parent67e1c0c17c3a15d0ce662601e8943306413e1c63
usb_storage: Don't freeze in usb-stor-scan

Scanning cannot be run during suspend or hibernation, but if
usb-stor-scan freezes another thread waiting on scanning to
complete may fail to freeze.

However, if usb-stor-scan is left freezable without ever actually
freezing then the freezer will wait on it to exit, and threads
waiting for scanning to finish will no longer be blocked. One
problem with this approach is that usb-stor-scan has a delay to
wait for devices to settle (which is currently the only point where
it can freeze). To work around this we can request that the freezer
send a fake signal when freezing, then use interruptible sleep to
wake the thread early when freezing happens.

To make this happen, the following changes are made to
usb-stor-scan:

 * Use set_freezable_with_signal() instead of set_freezable() to
   request a fake signal when freezing

 * Use wait_event_interruptible_timeout() instead of
   wait_event_freezable_timeout() to avoid freezing

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/storage/usb.c