Patch "scsi: ses: Retry failed Send/Receive Diagnostic commands" has been added to the 5.14-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    scsi: ses: Retry failed Send/Receive Diagnostic commands

to the 5.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     scsi-ses-retry-failed-send-receive-diagnostic-comman.patch
and it can be found in the queue-5.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 142ad785f2b9b0f4143b9a62b4422aa1becb6a03
Author: Wen Xiong <wenxiong@xxxxxxxxxxxxx>
Date:   Thu Sep 16 22:24:21 2021 -0500

    scsi: ses: Retry failed Send/Receive Diagnostic commands
    
    [ Upstream commit fbdac19e642899455b4e64c63aafe2325df7aafa ]
    
    Setting SCSI logging level with error=3, we saw some errors from enclosues:
    
    [108017.360833] ses 0:0:9:0: tag#641 Done: NEEDS_RETRY Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK cmd_age=0s
    [108017.360838] ses 0:0:9:0: tag#641 CDB: Receive Diagnostic 1c 01 01 00 20 00
    [108017.427778] ses 0:0:9:0: Power-on or device reset occurred
    [108017.427784] ses 0:0:9:0: tag#641 Done: SUCCESS Result: hostbyte=DID_OK driverbyte=DRIVER_OK cmd_age=0s
    [108017.427788] ses 0:0:9:0: tag#641 CDB: Receive Diagnostic 1c 01 01 00 20 00
    [108017.427791] ses 0:0:9:0: tag#641 Sense Key : Unit Attention [current]
    [108017.427793] ses 0:0:9:0: tag#641 Add. Sense: Bus device reset function occurred
    [108017.427801] ses 0:0:9:0: Failed to get diagnostic page 0x1
    [108017.427804] ses 0:0:9:0: Failed to bind enclosure -19
    [108017.427895] ses 0:0:10:0: Attached Enclosure device
    [108017.427942] ses 0:0:10:0: Attached scsi generic sg18 type 13
    
    Retry if the Send/Receive Diagnostic commands complete with a transient
    error status (NOT_READY or UNIT_ATTENTION with ASC 0x29).
    
    Link: https://lore.kernel.org/r/1631849061-10210-2-git-send-email-wenxiong@xxxxxxxxxxxxx
    Reviewed-by: Brian King <brking@xxxxxxxxxxxxx>
    Reviewed-by: James Bottomley <jejb@xxxxxxxxxxxxx>
    Signed-off-by: Wen Xiong <wenxiong@xxxxxxxxxxxxx>
    Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c
index c2afba2a5414..43e682297fd5 100644
--- a/drivers/scsi/ses.c
+++ b/drivers/scsi/ses.c
@@ -87,9 +87,16 @@ static int ses_recv_diag(struct scsi_device *sdev, int page_code,
 		0
 	};
 	unsigned char recv_page_code;
+	unsigned int retries = SES_RETRIES;
+	struct scsi_sense_hdr sshdr;
+
+	do {
+		ret = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, bufflen,
+				       &sshdr, SES_TIMEOUT, 1, NULL);
+	} while (ret > 0 && --retries && scsi_sense_valid(&sshdr) &&
+		 (sshdr.sense_key == NOT_READY ||
+		  (sshdr.sense_key == UNIT_ATTENTION && sshdr.asc == 0x29)));
 
-	ret =  scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, bufflen,
-				NULL, SES_TIMEOUT, SES_RETRIES, NULL);
 	if (unlikely(ret))
 		return ret;
 
@@ -121,9 +128,16 @@ static int ses_send_diag(struct scsi_device *sdev, int page_code,
 		bufflen & 0xff,
 		0
 	};
+	struct scsi_sense_hdr sshdr;
+	unsigned int retries = SES_RETRIES;
+
+	do {
+		result = scsi_execute_req(sdev, cmd, DMA_TO_DEVICE, buf, bufflen,
+					  &sshdr, SES_TIMEOUT, 1, NULL);
+	} while (result > 0 && --retries && scsi_sense_valid(&sshdr) &&
+		 (sshdr.sense_key == NOT_READY ||
+		  (sshdr.sense_key == UNIT_ATTENTION && sshdr.asc == 0x29)));
 
-	result = scsi_execute_req(sdev, cmd, DMA_TO_DEVICE, buf, bufflen,
-				  NULL, SES_TIMEOUT, SES_RETRIES, NULL);
 	if (result)
 		sdev_printk(KERN_ERR, sdev, "SEND DIAGNOSTIC result: %8x\n",
 			    result);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux