[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>
This commit is contained in:
Matthew Wilcox 2009-02-20 06:53:48 -07:00 committed by James Bottomley
parent 559595a985
commit 33dd6f92a1
1 changed files with 11 additions and 15 deletions

View File

@ -1167,23 +1167,19 @@ sd_spinup_disk(struct scsi_disk *sdkp)
/* /*
* The device does not want the automatic start to be issued. * The device does not want the automatic start to be issued.
*/ */
if (sdkp->device->no_start_on_add) { if (sdkp->device->no_start_on_add)
break; break;
}
/* if (sense_valid && sshdr.sense_key == NOT_READY) {
* If manual intervention is required, or this is an if (sshdr.asc == 4 && sshdr.ascq == 3)
* absent USB storage device, a spinup is meaningless. break; /* manual intervention required */
*/ if (sshdr.asc == 4 && sshdr.ascq == 0xb)
if (sense_valid && break; /* standby */
sshdr.sense_key == NOT_READY && if (sshdr.asc == 4 && sshdr.ascq == 0xc)
sshdr.asc == 4 && sshdr.ascq == 3) { break; /* unavailable */
break; /* manual intervention required */ /*
* Issue command to spin up drive when not ready
/* */
* Issue command to spin up drive when not ready
*/
} else if (sense_valid && sshdr.sense_key == NOT_READY) {
if (!spintime) { if (!spintime) {
sd_printk(KERN_NOTICE, sdkp, "Spinning up disk..."); sd_printk(KERN_NOTICE, sdkp, "Spinning up disk...");
cmd[0] = START_STOP; cmd[0] = START_STOP;