Skip to contentSkip to conversation

Drivers: scsi: storvsc: Properly handle errors from the host

PATCH RESEND In review K. Y. Srinivasan 2 participants 5 messages Apr 5, 2012 – Apr 25, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 Drivers: scsi: storvsc: Properly handle errors from the host

If the host returns error for pass through commands, deal with them appropriately. I would like to thank James for patiently helping me with this patch.

---
 drivers/scsi/storvsc_drv.c |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)
drivers/scsi/storvsc_drv.c +15 -5
index 83a1972..528d52b 100644
@@ -785,12 +785,22 @@ static void storvsc_command_completion(struct storvsc_cmd_request *cmd_request)
 	/*
 	 * If there is an error; offline the device since all
 	 * error recovery strategies would have already been
-	 * deployed on the host side.
+	 * deployed on the host side. However, if the command
+	 * were a pass-through command deal with it appropriately.
 	 */
-	if (vm_srb->srb_status == SRB_STATUS_ERROR)
-		scmnd->result = DID_TARGET_FAILURE << 16;
-	else
-		scmnd->result = vm_srb->scsi_status;
+	scmnd->result = vm_srb->scsi_status;
+
+	if (vm_srb->srb_status == SRB_STATUS_ERROR) {
+		switch (scmnd->cmnd[0]) {
+		case ATA_16:
+		case ATA_12:
+			set_host_byte(scmnd, DID_PASSTHROUGH);
+			break;
+		default:
+			set_host_byte(scmnd, DID_TARGET_FAILURE);
+		}
+	}
+
 
 	/*
 	 * If the LUN is invalid; remove the device.
Signature · 1 line
1.7.4.1
#1 lore raw
Quoted 13 lines

-----Original Message-----
From: K. Y. Srinivasan [mailto:[email protected]]
Sent: Thursday, April 05, 2012 3:27 PM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: KY Srinivasan
Subject: [PATCH RESEND 1/1] Drivers: scsi: storvsc: Properly handle errors from the host

Quoted 3 lines

If the host returns error for pass through commands, deal with them appropriately. I would like to thank James for patiently helping me with this patch.

James,

Thank you for suggesting the fix here. I hope this is what you were looking for.

Regards,

K. Y

Quoted 45 lines
---
 drivers/scsi/storvsc_drv.c |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)
drivers/scsi/storvsc_drv.c +15 -5
index 83a1972..528d52b 100644
@@ -785,12 +785,22 @@ static void storvsc_command_completion(struct
 storvsc_cmd_request *cmd_request)
 	/*
 	 * If there is an error; offline the device since all
 	 * error recovery strategies would have already been
-	 * deployed on the host side.
+	 * deployed on the host side. However, if the command
+	 * were a pass-through command deal with it appropriately.
 	 */
-	if (vm_srb->srb_status == SRB_STATUS_ERROR)
-		scmnd->result = DID_TARGET_FAILURE << 16;
-	else
-		scmnd->result = vm_srb->scsi_status;
+	scmnd->result = vm_srb->scsi_status;
+
+	if (vm_srb->srb_status == SRB_STATUS_ERROR) {
+		switch (scmnd->cmnd[0]) {
+		case ATA_16:
+		case ATA_12:
+			set_host_byte(scmnd, DID_PASSTHROUGH);
+			break;
+		default:
+			set_host_byte(scmnd, DID_TARGET_FAILURE);
+		}
+	}
+
 
 	/*

* If the LUN is invalid; remove the device.
--
1.7.4.1

#2 lore raw
In reply to K. Y. Srinivasan
Quoted 29 lines

-----Original Message-----
From: KY Srinivasan
Sent: Tuesday, April 10, 2012 11:14 AM
To: KY Srinivasan; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH RESEND 1/1] Drivers: scsi: storvsc: Properly handle errors from the host

Quoted 11 lines

-----Original Message-----
From: K. Y. Srinivasan [mailto:[email protected]]
Sent: Thursday, April 05, 2012 3:27 PM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: KY Srinivasan
Subject: [PATCH RESEND 1/1] Drivers: scsi: storvsc: Properly handle errors from the host

Quoted 3 lines

If the host returns error for pass through commands, deal with them appropriately. I would like to thank James for patiently helping me with this patch.

Quoted 7 lines

James,

Thank you for suggesting the fix here. I hope this is what you were looking for.

Regards,

K. Y

Ping.

Quoted 45 lines
Quoted 45 lines
---
 drivers/scsi/storvsc_drv.c |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)
drivers/scsi/storvsc_drv.c +15 -5
index 83a1972..528d52b 100644
@@ -785,12 +785,22 @@ static void storvsc_command_completion(struct
 storvsc_cmd_request *cmd_request)
 	/*
 	 * If there is an error; offline the device since all
 	 * error recovery strategies would have already been
-	 * deployed on the host side.
+	 * deployed on the host side. However, if the command
+	 * were a pass-through command deal with it appropriately.
 	 */
-	if (vm_srb->srb_status == SRB_STATUS_ERROR)
-		scmnd->result = DID_TARGET_FAILURE << 16;
-	else
-		scmnd->result = vm_srb->scsi_status;
+	scmnd->result = vm_srb->scsi_status;
+
+	if (vm_srb->srb_status == SRB_STATUS_ERROR) {
+		switch (scmnd->cmnd[0]) {
+		case ATA_16:
+		case ATA_12:
+			set_host_byte(scmnd, DID_PASSTHROUGH);
+			break;
+		default:
+			set_host_byte(scmnd, DID_TARGET_FAILURE);
+		}
+	}
+
 
 	/*

* If the LUN is invalid; remove the device.
--
1.7.4.1

maintainer
#3 lore raw
Quoted 28 lines · KY Srinivasan
Quoted 28 lines

-----Original Message-----
From: KY Srinivasan
Sent: Tuesday, April 10, 2012 11:14 AM
To: KY Srinivasan; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH RESEND 1/1] Drivers: scsi: storvsc: Properly handle errors from the host

Quoted 14 lines

-----Original Message-----
From: K. Y. Srinivasan [mailto:[email protected]]
Sent: Thursday, April 05, 2012 3:27 PM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: KY Srinivasan
Subject: [PATCH RESEND 1/1] Drivers: scsi: storvsc: Properly handle errors from the host

If the host returns error for pass through commands, deal with them appropriately. I would like to thank James for patiently helping me with this patch.

Quoted 7 lines
Quoted 7 lines

James,

Thank you for suggesting the fix here. I hope this is what you were looking for.

Regards,

K. Y

OK, I have the patch, but the change log is a bit rubbish. I changed it to

Hyper-V cannot process some commands like ATA_12 and ATA_16. It also returns a very generic error when this happens (SRB_STATUS_ERROR). Most of the time we treat SRB_STATUS_ERROR as DID_TARGET_FAILURE which causes error handler retry, but in the case of pass through commands, they'll never succeed (and the error handler will offline the device), so put a discriminating block in the command completion routing and send the SRB_STATUS_ERROR upwards with DID_PASSTHROUGH for commands we know should not be retried.

James

#4 lore raw
Quoted 57 lines

-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Wednesday, April 25, 2012 4:53 AM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH RESEND 1/1] Drivers: scsi: storvsc: Properly handle errors from the host

Quoted 5 lines · KY Srinivasan
Quoted 5 lines

-----Original Message-----
From: KY Srinivasan
Sent: Tuesday, April 10, 2012 11:14 AM
To: KY Srinivasan; [email protected]; linux-

[email protected];

Quoted 1 line
Quoted 1 line

[email protected]; [email protected];

[email protected];

Quoted 7 lines
Quoted 7 lines

[email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH RESEND 1/1] Drivers: scsi: storvsc: Properly handle errors from the host

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

-----Original Message-----
From: K. Y. Srinivasan [mailto:[email protected]]
Sent: Thursday, April 05, 2012 3:27 PM
To: [email protected]; [email protected]; [email protected]; [email protected];

[email protected];

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

[email protected]; [email protected]; [email protected]; [email protected]
Cc: KY Srinivasan
Subject: [PATCH RESEND 1/1] Drivers: scsi: storvsc: Properly handle errors

from

Quoted 9 lines
Quoted 9 lines
Quoted 5 lines

the host

If the host returns error for pass through commands, deal with them appropriately. I would like to thank James for patiently helping me with this patch.

James,

Thank you for suggesting the fix here. I hope this is what you were looking

for.

Quoted 4 lines
Quoted 4 lines

Regards,

K. Y

OK, I have the patch, but the change log is a bit rubbish. I changed it to

Quoted 11 lines

Hyper-V cannot process some commands like ATA_12 and ATA_16. It also returns a
very generic error when this happens (SRB_STATUS_ERROR). Most of the time we
treat SRB_STATUS_ERROR as DID_TARGET_FAILURE which causes error handler retry,
but in the case of pass through commands, they'll never succeed (and the error handler will offline the device), so put a discriminating block in the command completion routing and send the SRB_STATUS_ERROR upwards with DID_PASSTHROUGH
for commands we know should not be retried.

Looks good; thanks James.

K. Y