Commit c463696e authored by Matthew Dharm's avatar Matthew Dharm Committed by Greg Kroah-Hartman

[PATCH] USB Storage: fixes to usb-storage scanning thread

This was originally patch as401 from Alan Stern.  This patch makes a couple
of small changes to the new scanning thread.

It changes the name to "usb-stor-scan", which was my original intention and
makes more sense than the current name.

It also removes the PF_NOFREEZE flag; if someone suspends their system
immediately after plugging in a USB storage device then the scanning thread
should be frozen along with everything else.  The delay will be restarted
after the system wakes up.
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarMatthew Dharm <mdharm-usb@one-eyed-alien.net>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 838eea26
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include <linux/config.h> #include <linux/config.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/suspend.h>
#include <scsi/scsi.h> #include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h> #include <scsi/scsi_cmnd.h>
...@@ -897,8 +898,7 @@ static int usb_stor_scan_thread(void * __us) ...@@ -897,8 +898,7 @@ static int usb_stor_scan_thread(void * __us)
* so get rid of all our resources. * so get rid of all our resources.
*/ */
lock_kernel(); lock_kernel();
daemonize("usb-stor"); daemonize("usb-stor-scan");
current->flags |= PF_NOFREEZE;
unlock_kernel(); unlock_kernel();
printk(KERN_DEBUG printk(KERN_DEBUG
...@@ -908,9 +908,14 @@ static int usb_stor_scan_thread(void * __us) ...@@ -908,9 +908,14 @@ static int usb_stor_scan_thread(void * __us)
if (delay_use > 0) { if (delay_use > 0) {
printk(KERN_DEBUG "usb-storage: waiting for device " printk(KERN_DEBUG "usb-storage: waiting for device "
"to settle before scanning\n"); "to settle before scanning\n");
retry:
wait_event_interruptible_timeout(us->scsi_scan_wait, wait_event_interruptible_timeout(us->scsi_scan_wait,
test_bit(US_FLIDX_DISCONNECTING, &us->flags), test_bit(US_FLIDX_DISCONNECTING, &us->flags),
delay_use * HZ); delay_use * HZ);
if (current->flags & PF_FREEZE) {
refrigerator(PF_FREEZE);
goto retry;
}
} }
/* If the device is still connected, perform the scanning */ /* If the device is still connected, perform the scanning */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment