From: Hannes Reinecke <hare@suse.de>
Date: Thu, 9 Apr 2015 08:16:25 +0200
Subject: sd: always retry READ CAPACITY for ALUA state transition
References: bsc#895814
Patch-Mainline: submitted to linux-scsi
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.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
drivers/scsi/sd.c | 10 ++++++++++
1 file changed, 10 insertions(+)
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2341,6 +2341,11 @@ static int read_capacity_16(struct scsi_
* 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--;
@@ -2426,6 +2431,11 @@ static int read_capacity_10(struct scsi_
* 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--;