All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: linux-scsi@vger.kernel.org
Cc: Hannes Reinecke <hare@suse.de>,
	James Bottomley <jbottomley@parallels.com>
Subject: [PATCH] scsi: return TARGET_ERROR when a device has been disconnected
Date: Thu, 16 Aug 2012 08:40:08 +0200	[thread overview]
Message-ID: <1345099208-31687-1-git-send-email-hare@suse.de> (raw)

When we receive a sense code of
NOT READY, LOGICAL UNIT NOT SUPPORTED
the device has been disconnected and any retry on other paths
would be pointless. So return TARGET_ERROR here.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Cc: James Bottomley <jbottomley@parallels.com>
---
 drivers/scsi/scsi_error.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index de2337f..0fe639e 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -296,6 +296,10 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
 
 		return NEEDS_RETRY;
 	case NOT_READY:
+		if ((sshdr.asc == 0x25) && (sshdr.ascq == 0)) {
+			/* Logical unit not supported */
+			return TARGET_ERROR;
+		}
 	case UNIT_ATTENTION:
 		/*
 		 * if we are expecting a cc/ua because of a bus reset that we
-- 
1.7.4.2


             reply	other threads:[~2012-08-16  6:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-16  6:40 Hannes Reinecke [this message]
2012-08-16 14:53 ` [PATCH] scsi: return TARGET_ERROR when a device has been disconnected Michael Christie
2012-08-16 14:59   ` Hannes Reinecke

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=1345099208-31687-1-git-send-email-hare@suse.de \
    --to=hare@suse.de \
    --cc=jbottomley@parallels.com \
    --cc=linux-scsi@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.