Skip to contentSkip to conversation

scsi: return TARGET_ERROR when a device has been disconnected

PATCH In review Hannes Reinecke 2 participants 3 messages Aug 16, 2012 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: return TARGET_ERROR when a device has been disconnected

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.

---
 drivers/scsi/scsi_error.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/scsi/scsi_error.c +4 -0
index de2337f..0fe639e 100644
@@ -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
Signature · 1 line
1.7.4.2
#1 lore raw
Quoted 4 lines · Hannes Reinecke

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?

#2 lore raw
Quoted 10 lines · Michael Christie
Quoted 4 lines · Hannes Reinecke

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.

Quoted 3 lines

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

Yes, presumably.

Quoted 3 lines

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}?

Quoted 2 lines

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.

Quoted 2 lines

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

Signature · 10 lines
Dr. Hannes Reinecke		      zSeries & Storage
[email protected]			      +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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html