diff mbox series

[1/1] scsi/ses: Saw "Failed to get diagnostic page 0x1" during

Message ID 1629230255-11616-1-git-send-email-wenxiong@linux.vnet.ibm.com (mailing list archive)
State Accepted
Headers show
Series [1/1] scsi/ses: Saw "Failed to get diagnostic page 0x1" during | expand

Commit Message

wenxiong@linux.vnet.ibm.com Aug. 17, 2021, 7:57 p.m. UTC
From: Wen Xiong <wenxiong@linux.vnet.ibm.com>

We saw two errors with Slider drawer:
- Failed to get diagnostic page 0x1 during booting up
- /sys/class/enclosure are empty with ipr adapter + Slider drawer

From scsi logging level with error=3, looks ses_recv_diag not try on a UA.
Added scsi_test_unit_ready() which retried with UA. The patch fixes
both of above errors.

Signed-Off-by: Wen Xiong <wenxiong@linux.vnet.ibm.com>
Reviewed-by: Brian King <brking@linux.vnet.ibm.com>
---
 drivers/scsi/ses.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Martin K. Petersen Sept. 8, 2021, 4:12 a.m. UTC | #1
Hi Wendy!

> From scsi logging level with error=3, looks ses_recv_diag not try on a
> UA.  Added scsi_test_unit_ready() which retried with UA. The patch
> fixes both of above errors.

As your own commit message indicates, scsi_recv_diag() does not retry on
Unit Attention. I would like to see a fix which addresses that
deficiency in general and not just during the first invocation.

I suggest you modify scsi_recv_diag() to retry the RECEIVE DIAGNOSTIC
operation after getting a transient error.

Thanks!
diff mbox series

Patch

diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c
index c2afba2a5414..5811639a0747 100644
--- a/drivers/scsi/ses.c
+++ b/drivers/scsi/ses.c
@@ -633,6 +633,8 @@  static int ses_intf_add(struct device *cdev,
 	int num_enclosures;
 	struct enclosure_device *edev;
 	struct ses_component *scomp = NULL;
+	struct scsi_sense_hdr sshdr;
+	int ret;
 
 	if (!scsi_device_enclosure(sdev)) {
 		/* not an enclosure, but might be in one */
@@ -654,6 +656,10 @@  static int ses_intf_add(struct device *cdev,
 	if (!hdr_buf || !ses_dev)
 		goto err_init_free;
 
+	ret = scsi_test_unit_ready(sdev, SES_TIMEOUT, SES_RETRIES, &sshdr);
+	if (!scsi_status_is_good(ret))
+		goto err_init_free;
+
 	page = 1;
 	result = ses_recv_diag(sdev, page, hdr_buf, INIT_ALLOC_SIZE);
 	if (result)