Skip to contentSkip to conversation

sd: always retry READ CAPACITY for ALUA state transition

PATCH Superseded Hannes Reinecke 3 participants 5 messages Apr 27, 2015 – May 1, 2015 SCSI

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sd: always retry READ CAPACITY for ALUA state transition

During ALUA state transitions the device might return a sense code 02/04/0a (Logical unit not accessible, asymmetric access state transition). As this is a transient error we should just retry the READ CAPACITY call until the state transition finishes and the correct capacity can be returned.

---
 drivers/scsi/sd.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/scsi/sd.c +10 -0
index 79beebf..7178b05 100644
@@ -1987,6 +1987,11 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp,
 				 * give it one more chance */
 				if (--reset_retries > 0)
 					continue;
+			if (sense_valid &&
+			    sshdr.sense_key == NOT_READY &&
+			    sshdr.asc == 0x04 && sshdr.ascq == 0x0A)
+				/* ALUA state transition; always retry */
+				continue;
 		}
 		retries--;
 
@@ -2069,6 +2074,11 @@ static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp,
 				 * give it one more chance */
 				if (--reset_retries > 0)
 					continue;
+			if (sense_valid &&
+			    sshdr.sense_key == NOT_READY &&
+			    sshdr.asc == 0x04 && sshdr.ascq == 0x0A)
+				/* ALUA state transition; always retry */
+				continue;
 		}
 		retries--;
 
Signature · 1 line
1.8.5.2
maintainer
#1 lore raw
Quoted 30 lines · Hannes Reinecke

During ALUA state transitions the device might return a sense code 02/04/0a (Logical unit not accessible, asymmetric access state transition). As this is a transient error we should just retry the READ CAPACITY call until the state transition finishes and the correct capacity can be returned.

---
 drivers/scsi/sd.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/scsi/sd.c +5 -0
index 79beebf..7178b05 100644
@@ -1987,6 +1987,11 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp,
 				 * give it one more chance */
 				if (--reset_retries > 0)
 					continue;
+			if (sense_valid &&
+			    sshdr.sense_key == NOT_READY &&
+			    sshdr.asc == 0x04 && sshdr.ascq == 0x0A)
+				/* ALUA state transition; always retry */
+				continue;
 		}
 		retries--;
 
@@ -2069,6 +2074,11 @@ static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp,
 				 * give it one more chance */

drivers/scsi/sd.c static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp, · line 2084

Quoted 10 lines
drivers/scsi/sd.c +5 -0
 				if (--reset_retries > 0)
 					continue;
+			if (sense_valid &&
+			    sshdr.sense_key == NOT_READY &&
+			    sshdr.asc == 0x04 && sshdr.ascq == 0x0A)
+				/* ALUA state transition; always retry */
+				continue;
 		}
 		retries--;
 

Got to say I really don't like this infinite retry possibility. How long does the ALUA transition take? Would increasing retries work (or even hijacking reset_retries)?

James

#2 lore raw
Quoted 29 lines · James Bottomley
Quoted 28 lines · Hannes Reinecke

During ALUA state transitions the device might return a sense code 02/04/0a (Logical unit not accessible, asymmetric access state transition). As this is a transient error we should just retry the READ CAPACITY call until the state transition finishes and the correct capacity can be returned.

---
 drivers/scsi/sd.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/scsi/sd.c +5 -0
index 79beebf..7178b05 100644
@@ -1987,6 +1987,11 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp,
 				 * give it one more chance */
 				if (--reset_retries > 0)
 					continue;
+			if (sense_valid &&
+			    sshdr.sense_key == NOT_READY &&
+			    sshdr.asc == 0x04 && sshdr.ascq == 0x0A)
+				/* ALUA state transition; always retry */
+				continue;
 		}
 		retries--;
 
Quoted 17 lines

drivers/scsi/sd.c static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp, · line 2084

Quoted 12 lines
drivers/scsi/sd.c +5 -0
@@ -2069,6 +2074,11 @@ static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp,
 				 * give it one more chance */
 				if (--reset_retries > 0)
 					continue;
+			if (sense_valid &&
+			    sshdr.sense_key == NOT_READY &&
+			    sshdr.asc == 0x04 && sshdr.ascq == 0x0A)
+				/* ALUA state transition; always retry */
+				continue;
 		}
 		retries--;
 

Got to say I really don't like this infinite retry possibility. How long does the ALUA transition take? Would increasing retries work (or even hijacking reset_retries)?

Well ... transitioning could be quite long (NetApp FAS has a transition timeout of 30 _minutes_ ...).
But yeah, I could see to limit this somewhat.

Cheers,

Hannes

Signature · 9 lines
Dr. Hannes Reinecke		               zSeries & Storage
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw
Quoted 47 lines · Hannes Reinecke
Quoted 29 lines · James Bottomley
Quoted 28 lines · Hannes Reinecke

During ALUA state transitions the device might return a sense code 02/04/0a (Logical unit not accessible, asymmetric access state transition). As this is a transient error we should just retry the READ CAPACITY call until the state transition finishes and the correct capacity can be returned.

---
  drivers/scsi/sd.c | 10 ++++++++++
  1 file changed, 10 insertions(+)
drivers/scsi/sd.c +5 -0
index 79beebf..7178b05 100644
@@ -1987,6 +1987,11 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp,
  				 * give it one more chance */
  				if (--reset_retries > 0)
  					continue;
+			if (sense_valid &&
+			    sshdr.sense_key == NOT_READY &&
+			    sshdr.asc == 0x04 && sshdr.ascq == 0x0A)
+				/* ALUA state transition; always retry */
+				continue;
  		}
  		retries--;
 
Quoted 17 lines

drivers/scsi/sd.c static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp, · line 2084

Quoted 12 lines
drivers/scsi/sd.c +5 -0
@@ -2069,6 +2074,11 @@ static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp,
  				 * give it one more chance */
  				if (--reset_retries > 0)
  					continue;
+			if (sense_valid &&
+			    sshdr.sense_key == NOT_READY &&
+			    sshdr.asc == 0x04 && sshdr.ascq == 0x0A)
+				/* ALUA state transition; always retry */
+				continue;
  		}
  		retries--;
 

Got to say I really don't like this infinite retry possibility. How long does the ALUA transition take? Would increasing retries work (or even hijacking reset_retries)?

Quoted 2 lines

Well ... transitioning could be quite long (NetApp FAS has a transition timeout of 30 _minutes_ ...).

Well, actually NetApp FAS has a transition timeout of 2 minutes, and not 30 minutes - as reported in the IMPLICIT TRANSITION TIMEOUT value in the extended RTPG data.

-Martin

maintainer
#4 lore raw
In reply to Hannes Reinecke
Quoted 47 lines · Hannes Reinecke
Quoted 29 lines · James Bottomley
Quoted 28 lines · Hannes Reinecke

During ALUA state transitions the device might return a sense code 02/04/0a (Logical unit not accessible, asymmetric access state transition). As this is a transient error we should just retry the READ CAPACITY call until the state transition finishes and the correct capacity can be returned.

---
 drivers/scsi/sd.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/scsi/sd.c +5 -0
index 79beebf..7178b05 100644
@@ -1987,6 +1987,11 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp,
 				 * give it one more chance */
 				if (--reset_retries > 0)
 					continue;
+			if (sense_valid &&
+			    sshdr.sense_key == NOT_READY &&
+			    sshdr.asc == 0x04 && sshdr.ascq == 0x0A)
+				/* ALUA state transition; always retry */
+				continue;
 		}
 		retries--;
 
Quoted 17 lines

drivers/scsi/sd.c static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp, · line 2084

Quoted 12 lines
drivers/scsi/sd.c +5 -0
@@ -2069,6 +2074,11 @@ static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp,
 				 * give it one more chance */
 				if (--reset_retries > 0)
 					continue;
+			if (sense_valid &&
+			    sshdr.sense_key == NOT_READY &&
+			    sshdr.asc == 0x04 && sshdr.ascq == 0x0A)
+				/* ALUA state transition; always retry */
+				continue;
 		}
 		retries--;
 

Got to say I really don't like this infinite retry possibility. How long does the ALUA transition take? Would increasing retries work (or even hijacking reset_retries)?

Quoted 3 lines

Well ... transitioning could be quite long (NetApp FAS has a transition timeout of 30 _minutes_ ...).
But yeah, I could see to limit this somewhat.

I think that might be a good idea. We can't hold this device (and the corresponding asynchronous probe thread) in a continuous loop for 30 minutes ...

James