[PATCH 2/3] ses: skip error messages for invalid LUNs

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

 



Some storage array set the 'Embedded enclosure' bit even though
no LUN is present, causing the first RECEIVE DIAGNOSTIC call to
be returned with sense code 'LOGICAL UNIT NOT SUPPORTED'.
This patch skips the annoying 'Failed to get diagnostic page 0x1'
messages for those cases.

Signed-off-by: Hannes Reinecke <hare@xxxxxxxx>
---
 drivers/scsi/ses.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c
index e8ffee1..c1f96b0 100644
--- a/drivers/scsi/ses.c
+++ b/drivers/scsi/ses.c
@@ -110,12 +110,17 @@ static int ses_recv_diag(struct scsi_device *sdev, int page_code,
 		0
 	};
 	unsigned char recv_page_code;
+	struct scsi_sense_hdr sshdr;
 
 	ret =  scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, bufflen,
-				NULL, SES_TIMEOUT, SES_RETRIES, NULL);
-	if (unlikely(ret))
+				&sshdr, SES_TIMEOUT, SES_RETRIES, NULL);
+	if (unlikely(ret)) {
+		if (status_byte(ret) == CHECK_CONDITION &&
+		    sshdr.asc == 0x25 && sshdr.ascq == 0x00) {
+			ret = -ENODEV;
+		}
 		return ret;
-
+	}
 	recv_page_code = ((unsigned char *)buf)[0];
 
 	if (likely(recv_page_code == page_code))
@@ -674,9 +679,14 @@ static int ses_intf_add(struct device *cdev,
 
 	page = 1;
 	result = ses_recv_diag(sdev, page, hdr_buf, ses_alloc_size);
-	if (result)
+	if (result) {
+		if (result == -ENODEV &&
+		    sdev->inq_periph_qual != 0) {
+			kfree(hdr_buf);
+			return result;
+		}
 		goto recv_failed;
-
+	}
 	len = (hdr_buf[2] << 8) + hdr_buf[3] + 4;
 	buf = kzalloc(len, GFP_KERNEL);
 	if (!buf)
-- 
1.8.5.6




[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