[PATCH] sd: Fixup capacity for standby ports

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If a target port is in ALUA 'standby' state it does not need
to respond to a 'READ CAPACITY' command. So fixup the initialization
for these cases.

Signed-off-by: Hannes Reinecke <hare@xxxxxxx>
---
 drivers/scsi/sd.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 7178b05..62065a6 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1992,6 +1992,11 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp,
 			    sshdr.asc == 0x04 && sshdr.ascq == 0x0A)
 				/* ALUA state transition; always retry */
 				continue;
+			if (sense_valid &&
+			    sshdr.sense_key == NOT_READY &&
+			    sshdr.asc == 0x04 && sshdr.ascq == 0x0B)
+				/* Target port in standy state */
+				return 0;
 		}
 		retries--;
 
@@ -2079,6 +2084,11 @@ static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp,
 			    sshdr.asc == 0x04 && sshdr.ascq == 0x0A)
 				/* ALUA state transition; always retry */
 				continue;
+			if (sense_valid &&
+			    sshdr.sense_key == NOT_READY &&
+			    sshdr.asc == 0x04 && sshdr.ascq == 0x0B)
+				/* Target port in standy state */
+				return 0;
 		}
 		retries--;
 
@@ -2193,6 +2203,8 @@ got_data:
 		sector_size = 512;
 		sd_printk(KERN_NOTICE, sdkp, "Sector size 0 reported, "
 			  "assuming 512.\n");
+		if (!sdkp->physical_block_size)
+			sdkp->physical_block_size = sector_size;
 	}
 
 	if (sector_size != 512 &&
-- 
1.8.5.2

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux