linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: linux-scsi@vger.kernel.org
Cc: James Bottomley <jbottomley@parallels.com>,
	Hannes Reinecke <hare@suse.de>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Mike Snitzer <snitzer@redhat.com>
Subject: [PATCH] scsi_error: do not allow IO errors with certain ILLEGAL_REQUEST sense to be retryable
Date: Fri,  2 Dec 2011 15:31:29 -0500	[thread overview]
Message-ID: <1322857889-2623-1-git-send-email-snitzer@redhat.com> (raw)

Thin provisioned LUNs from multiple array vendors have failed WRITE SAME
(16) w/ UNMAP bit set with ILLEGAL_REQUEST sense.  With additional sense
0x24 and 0x26 respectively.

In both instances the target would always fail the CDB no matter how
many retries were performed (permanent target failure rather than
transient path failure).  This resulted in mkfs.ext4's discard of a
multipath device looping indefinitely while failing paths.

Additional sense 0x20 and 0x21 were included because both represent
TARGET_ERRORs too.  But not all ILLEGAL_REQUEST sense can be treated as
a TARGET_ERROR.

One example where a retry might be desirable is described in SBC-3, in
the "4.18 Model for XOR commands"

"When the device server is not able to accept a new command because
there is not enough space in the buffer, the device server shall
terminate that command with CHECK CONDITION status with the sense key
set to ILLEGAL REQUEST and the additional sense code set to BUFFER
FULL."

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
---
 drivers/scsi/scsi_error.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index dc6131e..33d3a50 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -366,6 +366,14 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
 			return TARGET_ERROR;
 
 	case ILLEGAL_REQUEST:
+		if (sshdr.asc == 0x20 || /* Invalid command operation code */
+		    sshdr.asc == 0x21 || /* Logical block address out of range */
+		    sshdr.asc == 0x24 || /* Invalid field in cdb */
+		    sshdr.asc == 0x26) { /* Parameter value invalid */
+			return TARGET_ERROR;
+		}
+		return SUCCESS;
+
 	default:
 		return SUCCESS;
 	}
-- 
1.7.4.4


             reply	other threads:[~2011-12-02 20:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-02 20:31 Mike Snitzer [this message]
2011-12-02 21:04 ` [PATCH] scsi_error: do not allow IO errors with certain ILLEGAL_REQUEST sense to be retryable James Bottomley
2011-12-02 22:04   ` Mike Snitzer
2011-12-06 21:07 ` [PATCH] " Martin K. Petersen
2011-12-06 21:27   ` Mike Snitzer
2011-12-06 22:03     ` Martin K. Petersen
2011-12-06 22:42       ` Mike Snitzer
2012-02-13 16:29         ` Mike Snitzer
2012-02-13 17:53           ` Martin K. Petersen
2012-02-13 18:13             ` Mike Snitzer
2012-02-13 18:59               ` Mike Snitzer
2012-02-13 19:16               ` Martin K. Petersen
2012-02-13 19:36                 ` Mike Snitzer
2012-02-13 19:38                   ` James Bottomley
2012-02-13 23:35 ` [PATCH v2] [SCSI] scsi_error: classify some ILLEGAL_REQUEST sense as a permanent TARGET_ERROR Mike Snitzer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1322857889-2623-1-git-send-email-snitzer@redhat.com \
    --to=snitzer@redhat.com \
    --cc=hare@suse.de \
    --cc=jbottomley@parallels.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).