aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_wait_scan.c
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@linux.intel.com>2009-04-21 16:32:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-21 22:40:00 -0400
commitd4d5291c8cd499b1b590336059d5cc3e24c1ced6 (patch)
treebb4c2ea559001e066bf3355c1e4d82b36cb916d6 /drivers/scsi/scsi_wait_scan.c
parent5dd559f020c98a2a4b3e063f09c0e4bc771ed838 (diff)
driver synchronization: make scsi_wait_scan more advanced
There is currently only one way for userspace to say "wait for my storage device to get ready for the modules I just loaded": to load the scsi_wait_scan module. Expectations of userspace are that once this module is loaded, all the (storage) devices for which the drivers were loaded before the module load are present. Now, there are some issues with the implementation, and the async stuff got caught in the middle of this: The existing code only waits for the scsy async probing to finish, but it did not take into account at all that probing might not have begun yet. (Russell ran into this problem on his computer and the fix works for him) This patch fixes this more thoroughly than the previous "fix", which had some bad side effects (namely, for kernel code that wanted to wait for the scsi scan it would also do an async sync, which would deadlock if you did it from async context already.. there's a report about that on lkml): The patch makes the module first wait for all device driver probes, and then it will wait for the scsi parallel scan to finish. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Tested-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/scsi/scsi_wait_scan.c')
-rw-r--r--drivers/scsi/scsi_wait_scan.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_wait_scan.c b/drivers/scsi/scsi_wait_scan.c
index 2f21af21269a..74708fcaf82f 100644
--- a/drivers/scsi/scsi_wait_scan.c
+++ b/drivers/scsi/scsi_wait_scan.c
@@ -11,10 +11,21 @@
11 */ 11 */
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/device.h>
14#include <scsi/scsi_scan.h> 15#include <scsi/scsi_scan.h>
15 16
16static int __init wait_scan_init(void) 17static int __init wait_scan_init(void)
17{ 18{
19 /*
20 * First we need to wait for device probing to finish;
21 * the drivers we just loaded might just still be probing
22 * and might not yet have reached the scsi async scanning
23 */
24 wait_for_device_probe();
25 /*
26 * and then we wait for the actual asynchronous scsi scan
27 * to finish.
28 */
18 scsi_complete_async_scans(); 29 scsi_complete_async_scans();
19 return 0; 30 return 0;
20} 31}