diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-18 21:15:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-18 21:15:46 -0400 |
commit | eea03c20ae38a55405c0865ed9adfccc400e4c8e (patch) | |
tree | 09800af230cd1ef6d9d83ac5e057d8085feca601 /drivers | |
parent | e2f3b78557ff11f58d836e016900c3210f4fb1c1 (diff) |
Make wait_for_device_probe() also do scsi_complete_async_scans()
Commit a7a20d103994 ("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 commit 43a8d39d0137 ("fix async probe
regression"), so that same commit a7a20d103994 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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/base/dd.c | 2 | ||||
-rw-r--r-- | drivers/scsi/scsi_wait_scan.c | 5 |
2 files changed, 2 insertions, 5 deletions
diff --git a/drivers/base/dd.c b/drivers/base/dd.c index dcb8a6e48692..4b01ab3d2c24 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/wait.h> | 24 | #include <linux/wait.h> |
25 | #include <linux/async.h> | 25 | #include <linux/async.h> |
26 | #include <linux/pm_runtime.h> | 26 | #include <linux/pm_runtime.h> |
27 | #include <scsi/scsi_scan.h> | ||
27 | 28 | ||
28 | #include "base.h" | 29 | #include "base.h" |
29 | #include "power/power.h" | 30 | #include "power/power.h" |
@@ -332,6 +333,7 @@ void wait_for_device_probe(void) | |||
332 | /* wait for the known devices to complete their probing */ | 333 | /* wait for the known devices to complete their probing */ |
333 | wait_event(probe_waitqueue, atomic_read(&probe_count) == 0); | 334 | wait_event(probe_waitqueue, atomic_read(&probe_count) == 0); |
334 | async_synchronize_full(); | 335 | async_synchronize_full(); |
336 | scsi_complete_async_scans(); | ||
335 | } | 337 | } |
336 | EXPORT_SYMBOL_GPL(wait_for_device_probe); | 338 | EXPORT_SYMBOL_GPL(wait_for_device_probe); |
337 | 339 | ||
diff --git a/drivers/scsi/scsi_wait_scan.c b/drivers/scsi/scsi_wait_scan.c index ae7814874618..072734538876 100644 --- a/drivers/scsi/scsi_wait_scan.c +++ b/drivers/scsi/scsi_wait_scan.c | |||
@@ -22,11 +22,6 @@ static int __init wait_scan_init(void) | |||
22 | * and might not yet have reached the scsi async scanning | 22 | * and might not yet have reached the scsi async scanning |
23 | */ | 23 | */ |
24 | wait_for_device_probe(); | 24 | wait_for_device_probe(); |
25 | /* | ||
26 | * and then we wait for the actual asynchronous scsi scan | ||
27 | * to finish. | ||
28 | */ | ||
29 | scsi_complete_async_scans(); | ||
30 | return 0; | 25 | return 0; |
31 | } | 26 | } |
32 | 27 | ||