1 From: Matthew Wilcox <matthew@wil.cx>
2 Date: Fri, 20 Feb 2009 13:53:48 +0000 (-0700)
3 Subject: sd: Don't try to spin up drives that are connected to an inactive port
4 X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Fjejb%2Fscsi-rc-fixes-2.6.git;a=commitdiff_plain;h=33dd6f92a1a7ad85c54d47fd9d73371a32c0bde4
7 We currently try to spin up drives connected to standby and unavailable
8 ports. This will never succeed and wastes a lot of time. Fail quickly
9 if the sense data reports the port is in standby or unavailable state.
11 Reported-by: Narayanan Rengarajan <narayanan.rengarajan@hp.com>
12 Tested-by: Narayanan Rengarajan <narayanan.rengarajan@hp.com>
13 Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
14 Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 Signed-off-by: Hannes Reinecke <hare@suse.de>
19 drivers/scsi/sd.c | 26 +++++++++++---------------
20 1 file changed, 11 insertions(+), 15 deletions(-)
22 --- a/drivers/scsi/sd.c
23 +++ b/drivers/scsi/sd.c
24 @@ -1172,23 +1172,19 @@ sd_spinup_disk(struct scsi_disk *sdkp)
26 * The device does not want the automatic start to be issued.
28 - if (sdkp->device->no_start_on_add) {
29 + if (sdkp->device->no_start_on_add)
34 - * If manual intervention is required, or this is an
35 - * absent USB storage device, a spinup is meaningless.
38 - sshdr.sense_key == NOT_READY &&
39 - sshdr.asc == 4 && sshdr.ascq == 3) {
40 - break; /* manual intervention required */
43 - * Issue command to spin up drive when not ready
45 - } else if (sense_valid && sshdr.sense_key == NOT_READY) {
46 + if (sense_valid && sshdr.sense_key == NOT_READY) {
47 + if (sshdr.asc == 4 && sshdr.ascq == 3)
48 + break; /* manual intervention required */
49 + if (sshdr.asc == 4 && sshdr.ascq == 0xb)
50 + break; /* standby */
51 + if (sshdr.asc == 4 && sshdr.ascq == 0xc)
52 + break; /* unavailable */
54 + * Issue command to spin up drive when not ready
57 sd_printk(KERN_NOTICE, sdkp, "Spinning up disk...");