From a8bbb2ab4e4fac8ebd2a402d5d81500cbeaaebaf Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Tue, 17 Oct 2017 09:10:56 +0200 Subject: scsi: scsi_error: Do not retry illegal function error Hitachi USP-V returns 'ILLEGAL FUNCTION' when the internal staging mechanism encountered an error. These errors should not be retried on another path. [mkp: s/invalid/illegal/] Signed-off-by: Hannes Reinecke Signed-off-by: Martin K. Petersen --- drivers/scsi/scsi_error.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/scsi/scsi_error.c') diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 38942050b265..5086489dac97 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -579,6 +579,7 @@ int scsi_check_sense(struct scsi_cmnd *scmd) case ILLEGAL_REQUEST: if (sshdr.asc == 0x20 || /* Invalid command operation code */ sshdr.asc == 0x21 || /* Logical block address out of range */ + sshdr.asc == 0x22 || /* Invalid function */ sshdr.asc == 0x24 || /* Invalid field in cdb */ sshdr.asc == 0x26) { /* Parameter value invalid */ set_host_byte(scmd, DID_TARGET_FAILURE); -- cgit From cf3431bba1df3b4f25b04900cb804d7e6e5eb6a9 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Tue, 17 Oct 2017 09:11:24 +0200 Subject: scsi: scsi_error: Handle power-on reset unit attention As per SAM there is a status precedence, with any sense code 29/XX taking second place just after an ACA ACTIVE status. Additionally, each target might prefer to not queue any unit attention conditions, but just report one. Due to the above, this will be that one with the highest precedence. This results in the sense code 29/XX effectively overwriting any other unit attention. Hence we should report the power-on reset to userland so that it can take appropriate action. Signed-off-by: Hannes Reinecke Signed-off-by: Martin K. Petersen --- drivers/scsi/scsi_error.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'drivers/scsi/scsi_error.c') diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 5086489dac97..d670027f598f 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -403,6 +403,12 @@ static void scsi_report_sense(struct scsi_device *sdev, "threshold.\n"); } + if (sshdr->asc == 0x29) { + evt_type = SDEV_EVT_POWER_ON_RESET_OCCURRED; + sdev_printk(KERN_WARNING, sdev, + "Power-on or device reset occurred\n"); + } + if (sshdr->asc == 0x2a && sshdr->ascq == 0x01) { evt_type = SDEV_EVT_MODE_PARAMETER_CHANGE_REPORTED; sdev_printk(KERN_WARNING, sdev, -- cgit From ad95028a2e88e59fadda79141e74546d12ba3b4b Mon Sep 17 00:00:00 2001 From: Petros Koutoupis Date: Mon, 30 Oct 2017 16:38:10 -0500 Subject: scsi: scsi_error: DID_SOFT_ERROR comment clean up Updated comment. We are keeping track of maximum number of retries per command via retries/allowed in struct scsi_cmnd. Corrected comment positioning. [mkp: applied by hand] Signed-off-by: Petros Koutoupis Signed-off-by: Martin K. Petersen --- drivers/scsi/scsi_error.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'drivers/scsi/scsi_error.c') diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index d670027f598f..ae0486332ea8 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -1753,16 +1753,12 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd) * that it indicates SUCCESS. */ return SUCCESS; + case DID_SOFT_ERROR: /* * when the low level driver returns did_soft_error, * it is responsible for keeping an internal retry counter * in order to avoid endless loops (db) - * - * actually this is a bug in this function here. we should - * be mindful of the maximum number of retries specified - * and not get stuck in a loop. */ - case DID_SOFT_ERROR: goto maybe_retry; case DID_IMM_RETRY: return NEEDS_RETRY; -- cgit