linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: return TARGET_ERROR when a device has been disconnected
@ 2012-08-16  6:40 Hannes Reinecke
  2012-08-16 14:53 ` Michael Christie
  0 siblings, 1 reply; 3+ messages in thread
From: Hannes Reinecke @ 2012-08-16  6:40 UTC (permalink / raw)
  To: linux-scsi; +Cc: Hannes Reinecke, James Bottomley

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: return TARGET_ERROR when a device has been disconnected
  2012-08-16  6:40 [PATCH] scsi: return TARGET_ERROR when a device has been disconnected Hannes Reinecke
@ 2012-08-16 14:53 ` Michael Christie
  2012-08-16 14:59   ` Hannes Reinecke
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Christie @ 2012-08-16 14:53 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: linux-scsi, James Bottomley


On Aug 16, 2012, at 1:40 AM, Hannes Reinecke <hare@suse.de> wrote:

> 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.


What target is this with? What about {ILLEGAL_REQUEST,  LOGICAL UNIT NOT SUPPORTED}? Would you want to do the same behavior for that error?

I ask because I have seen targets return {ILLEGAL_REQUEST,  LOGICAL UNIT NOT SUPPORTED} when you only unexport the LUN from a path/port on the target. I was wondering if some might do the same for {NOT_READY, LOGICAL UNIT NOT SUPPORTED}? In those cases, we would not want multipath to fail IO.

In these type of cases should the target be returning something else?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: return TARGET_ERROR when a device has been disconnected
  2012-08-16 14:53 ` Michael Christie
@ 2012-08-16 14:59   ` Hannes Reinecke
  0 siblings, 0 replies; 3+ messages in thread
From: Hannes Reinecke @ 2012-08-16 14:59 UTC (permalink / raw)
  To: Michael Christie; +Cc: linux-scsi, James Bottomley

On 08/16/2012 04:53 PM, Michael Christie wrote:
> 
> On Aug 16, 2012, at 1:40 AM, Hannes Reinecke <hare@suse.de> wrote:
> 
>> 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.
> 
> 
> What target is this with?

HP EVA.

> What about {ILLEGAL_REQUEST,  LOGICAL UNIT NOT SUPPORTED}?
> Would you want to do the same behavior for that error?
> 
Yes, presumably.

> I ask because I have seen targets return {ILLEGAL_REQUEST,  LOGICAL UNIT NOT SUPPORTED}
> when you only unexport the LUN from a path/port on the target.
> I was wondering if some might do the same for {NOT_READY, LOGICAL
UNIT NOT SUPPORTED}?
> In those cases, we would not want multipath to fail IO.
> 
That's exactly the use-case. When you unexport a target you're
getting the "LUN NOT SUPPORTED" message. And you'll need to return
the error to the upper layers, as you might want to disconnect the
device (eg do a 'rescan-scsi-bus.sh') and you'll want to finish any
program quickly here.

> In these type of cases should the target be returning something else?
> 
No, that's okay.
We should be modifying it to encompass both.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-08-16 14:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-16  6:40 [PATCH] scsi: return TARGET_ERROR when a device has been disconnected Hannes Reinecke
2012-08-16 14:53 ` Michael Christie
2012-08-16 14:59   ` Hannes Reinecke

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).