mirror of
https://github.com/torvalds/linux.git
synced 2024-11-05 11:32:04 +00:00
d4d5291c8c
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>
43 lines
1.1 KiB
C
43 lines
1.1 KiB
C
/*
|
|
* scsi_wait_scan.c
|
|
*
|
|
* Copyright (C) 2006 James Bottomley <James.Bottomley@SteelEye.com>
|
|
*
|
|
* This is a simple module to wait until all the async scans are
|
|
* complete. The idea is to use it in initrd/initramfs scripts. You
|
|
* modprobe it after all the modprobes of the root SCSI drivers and it
|
|
* will wait until they have all finished scanning their busses before
|
|
* allowing the boot to proceed
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
#include <linux/device.h>
|
|
#include <scsi/scsi_scan.h>
|
|
|
|
static int __init wait_scan_init(void)
|
|
{
|
|
/*
|
|
* First we need to wait for device probing to finish;
|
|
* the drivers we just loaded might just still be probing
|
|
* and might not yet have reached the scsi async scanning
|
|
*/
|
|
wait_for_device_probe();
|
|
/*
|
|
* and then we wait for the actual asynchronous scsi scan
|
|
* to finish.
|
|
*/
|
|
scsi_complete_async_scans();
|
|
return 0;
|
|
}
|
|
|
|
static void __exit wait_scan_exit(void)
|
|
{
|
|
}
|
|
|
|
MODULE_DESCRIPTION("SCSI wait for scans");
|
|
MODULE_AUTHOR("James Bottomley");
|
|
MODULE_LICENSE("GPL");
|
|
|
|
late_initcall(wait_scan_init);
|
|
module_exit(wait_scan_exit);
|