Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 33dd6f92 authored by Matthew Wilcox's avatar Matthew Wilcox Committed by James Bottomley
Browse files

[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: default avatarNarayanan Rengarajan <narayanan.rengarajan@hp.com>
Tested-by: default avatarNarayanan Rengarajan <narayanan.rengarajan@hp.com>
Signed-off-by: default avatarMatthew Wilcox <willy@linux.intel.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent 559595a9
Loading
Loading
Loading
Loading
+11 −15
Original line number Diff line number Diff line
@@ -1167,23 +1167,19 @@ sd_spinup_disk(struct scsi_disk *sdkp)
		/*
		 * 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;
		}

		/*
		 * If manual intervention is required, or this is an
		 * absent USB storage device, a spinup is meaningless.
		 */
		if (sense_valid &&
		    sshdr.sense_key == NOT_READY &&
		    sshdr.asc == 4 && sshdr.ascq == 3) {
		if (sense_valid && sshdr.sense_key == NOT_READY) {
			if (sshdr.asc == 4 && sshdr.ascq == 3)
				break;	/* manual intervention required */

			if (sshdr.asc == 4 && sshdr.ascq == 0xb)
				break;	/* standby */
			if (sshdr.asc == 4 && sshdr.ascq == 0xc)
				break;	/* unavailable */
			/*
			 * Issue command to spin up drive when not ready
			 */
		} else if (sense_valid && sshdr.sense_key == NOT_READY) {
			if (!spintime) {
				sd_printk(KERN_NOTICE, sdkp, "Spinning up disk...");
				cmd[0] = START_STOP;