eea03c20ae
Commita7a20d1039
("sd: limit the scope of the async probe domain") make the SCSI device probing run device discovery in it's own async domain. However, as a result, the partition detection was no longer synchronized by async_synchronize_full() (which, despite the name, only synchronizes the global async space, not all of them). Which in turn meant that "wait_for_device_probe()" would not wait for the SCSI partitions to be parsed. And "wait_for_device_probe()" was what the boot time init code relied on for mounting the root filesystem. Now, most people never noticed this, because not only is it timing-dependent, but modern distributions all use initrd. So the root filesystem isn't actually on a disk at all. And then before they actually mount the final disk filesystem, they will have loaded the scsi-wait-scan module, which not only does the expected wait_for_device_probe(), but also does scsi_complete_async_scans(). [ Side note: scsi_complete_async_scans() had also been partially broken, but that was fixed in commit43a8d39d01
("fix async probe regression"), so that same commita7a20d1039
had actually broken setups even if you used scsi-wait-scan explicitly ] Solve this problem by just moving the scsi_complete_async_scans() call into wait_for_device_probe(). Everybody who wants to wait for device probing to finish really wants the SCSI probing to complete, so there's no reason not to do this. So now "wait_for_device_probe()" really does what the name implies, and properly waits for device probing to finish. This also removes the now unnecessary extra calls to scsi_complete_async_scans(). Reported-and-tested-by: Artem S. Tashkinov <t.artem@mailcity.com> Cc: Dan Williams <dan.j.williams@gmail.com> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: James Bottomley <jbottomley@parallels.com> Cc: Borislav Petkov <bp@amd64.org> Cc: linux-scsi <linux-scsi@vger.kernel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
38 lines
958 B
C
38 lines
958 B
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_priv.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();
|
|
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);
|