aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sd.c
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew@wil.cx>2009-02-20 08:53:48 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-03-05 11:34:37 -0500
commit33dd6f92a1a7ad85c54d47fd9d73371a32c0bde4 (patch)
tree8390e0a43bac01b4e393d9ec35b8a58823e98da4 /drivers/scsi/sd.c
parent559595a985e106d2fa9f0c79b7f5805453fed593 (diff)
[SCSI] sd: Don't try to spin up drives that are connected to an inactive port
We currently try to spin up drives connected to standby and unavailable ports. This will never succeed and wastes a lot of time. Fail quickly if the sense data reports the port is in standby or unavailable state. Reported-by: Narayanan Rengarajan <narayanan.rengarajan@hp.com> Tested-by: Narayanan Rengarajan <narayanan.rengarajan@hp.com> Signed-off-by: Matthew Wilcox <willy@linux.intel.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r--drivers/scsi/sd.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 55310dbc10a..4970ae4a62d 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1167,23 +1167,19 @@ sd_spinup_disk(struct scsi_disk *sdkp)
1167 /* 1167 /*
1168 * The device does not want the automatic start to be issued. 1168 * The device does not want the automatic start to be issued.
1169 */ 1169 */
1170 if (sdkp->device->no_start_on_add) { 1170 if (sdkp->device->no_start_on_add)
1171 break; 1171 break;
1172 }
1173
1174 /*
1175 * If manual intervention is required, or this is an
1176 * absent USB storage device, a spinup is meaningless.
1177 */
1178 if (sense_valid &&
1179 sshdr.sense_key == NOT_READY &&
1180 sshdr.asc == 4 && sshdr.ascq == 3) {
1181 break; /* manual intervention required */
1182 1172
1183 /* 1173 if (sense_valid && sshdr.sense_key == NOT_READY) {
1184 * Issue command to spin up drive when not ready 1174 if (sshdr.asc == 4 && sshdr.ascq == 3)
1185 */ 1175 break; /* manual intervention required */
1186 } else if (sense_valid && sshdr.sense_key == NOT_READY) { 1176 if (sshdr.asc == 4 && sshdr.ascq == 0xb)
1177 break; /* standby */
1178 if (sshdr.asc == 4 && sshdr.ascq == 0xc)
1179 break; /* unavailable */
1180 /*
1181 * Issue command to spin up drive when not ready
1182 */
1187 if (!spintime) { 1183 if (!spintime) {
1188 sd_printk(KERN_NOTICE, sdkp, "Spinning up disk..."); 1184 sd_printk(KERN_NOTICE, sdkp, "Spinning up disk...");
1189 cmd[0] = START_STOP; 1185 cmd[0] = START_STOP;