diff mbox series

[01/10] scsi: xen: Drop use of internal host codes.

Message ID 20220804034100.121125-2-michael.christie@oracle.com
State New
Headers show
Series scsi: Fix internal host code use | expand

Commit Message

Mike Christie Aug. 4, 2022, 3:40 a.m. UTC
The error codes:

DID_TARGET_FAILURE
DID_NEXUS_FAILURE
DID_ALLOC_FAILURE
DID_MEDIUM_ERROR

are internal to the SCSI layer. Drivers must not use them because:

1. They are not propagated upwards, so SG IO/passthrough users will not
see an error and think a command was successful.

xen-scsiback will never see this error and should not try to send it.

2. There is no handling for them in scsi_decide_disposition so if
xen-scsifront were to return the error to scsi-ml then it kicks off the
error handler which is definitely not what we want.

This patch remove the use from xen-scsifront/back.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
---
 drivers/scsi/xen-scsifront.c       |  8 --------
 drivers/xen/xen-scsiback.c         | 12 ------------
 include/xen/interface/io/vscsiif.h | 10 +---------
 3 files changed, 1 insertion(+), 29 deletions(-)

Comments

Juergen Gross Aug. 4, 2022, 6:18 a.m. UTC | #1
On 04.08.22 05:40, Mike Christie wrote:
> The error codes:
> 
> DID_TARGET_FAILURE
> DID_NEXUS_FAILURE
> DID_ALLOC_FAILURE
> DID_MEDIUM_ERROR
> 
> are internal to the SCSI layer. Drivers must not use them because:
> 
> 1. They are not propagated upwards, so SG IO/passthrough users will not
> see an error and think a command was successful.
> 
> xen-scsiback will never see this error and should not try to send it.
> 
> 2. There is no handling for them in scsi_decide_disposition so if
> xen-scsifront were to return the error to scsi-ml then it kicks off the
> error handler which is definitely not what we want.
> 
> This patch remove the use from xen-scsifront/back.
> 
> Signed-off-by: Mike Christie <michael.christie@oracle.com>
> ---
>   drivers/scsi/xen-scsifront.c       |  8 --------
>   drivers/xen/xen-scsiback.c         | 12 ------------
>   include/xen/interface/io/vscsiif.h | 10 +---------
>   3 files changed, 1 insertion(+), 29 deletions(-)
> 

...

> diff --git a/include/xen/interface/io/vscsiif.h b/include/xen/interface/io/vscsiif.h
> index 7ea4dc9611c4..44eb1f34f1a0 100644
> --- a/include/xen/interface/io/vscsiif.h
> +++ b/include/xen/interface/io/vscsiif.h
> @@ -316,16 +316,8 @@ struct vscsiif_response {
>   #define XEN_VSCSIIF_RSLT_HOST_TRANSPORT_DISRUPTED 14
>   /* Transport class fastfailed */
>   #define XEN_VSCSIIF_RSLT_HOST_TRANSPORT_FAILFAST  15
> -/* Permanent target failure */
> -#define XEN_VSCSIIF_RSLT_HOST_TARGET_FAILURE      16
> -/* Permanent nexus failure on path */
> -#define XEN_VSCSIIF_RSLT_HOST_NEXUS_FAILURE       17
> -/* Space allocation on device failed */
> -#define XEN_VSCSIIF_RSLT_HOST_ALLOC_FAILURE       18
> -/* Medium error */
> -#define XEN_VSCSIIF_RSLT_HOST_MEDIUM_ERROR        19
>   /* Transport marginal errors */
> -#define XEN_VSCSIIF_RSLT_HOST_TRANSPORT_MARGINAL  20
> +#define XEN_VSCSIIF_RSLT_HOST_TRANSPORT_MARGINAL  16

Please drop the modifications of this header.

This is a copy of the master from the Xen repository. It might be used
in multiple OS'es across many releases, so it needs to be regarded as ABI.


Juergen
diff mbox series

Patch

diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c
index 51afc66e839d..66b316d173b0 100644
--- a/drivers/scsi/xen-scsifront.c
+++ b/drivers/scsi/xen-scsifront.c
@@ -289,14 +289,6 @@  static unsigned int scsifront_host_byte(int32_t rslt)
 		return DID_TRANSPORT_DISRUPTED;
 	case XEN_VSCSIIF_RSLT_HOST_TRANSPORT_FAILFAST:
 		return DID_TRANSPORT_FAILFAST;
-	case XEN_VSCSIIF_RSLT_HOST_TARGET_FAILURE:
-		return DID_TARGET_FAILURE;
-	case XEN_VSCSIIF_RSLT_HOST_NEXUS_FAILURE:
-		return DID_NEXUS_FAILURE;
-	case XEN_VSCSIIF_RSLT_HOST_ALLOC_FAILURE:
-		return DID_ALLOC_FAILURE;
-	case XEN_VSCSIIF_RSLT_HOST_MEDIUM_ERROR:
-		return DID_MEDIUM_ERROR;
 	case XEN_VSCSIIF_RSLT_HOST_TRANSPORT_MARGINAL:
 		return DID_TRANSPORT_MARGINAL;
 	default:
diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c
index 7a0c93acc2c5..e98c88a960d8 100644
--- a/drivers/xen/xen-scsiback.c
+++ b/drivers/xen/xen-scsiback.c
@@ -333,18 +333,6 @@  static int32_t scsiback_result(int32_t result)
 	case DID_TRANSPORT_FAILFAST:
 		host_status = XEN_VSCSIIF_RSLT_HOST_TRANSPORT_FAILFAST;
 		break;
-	case DID_TARGET_FAILURE:
-		host_status = XEN_VSCSIIF_RSLT_HOST_TARGET_FAILURE;
-		break;
-	case DID_NEXUS_FAILURE:
-		host_status = XEN_VSCSIIF_RSLT_HOST_NEXUS_FAILURE;
-		break;
-	case DID_ALLOC_FAILURE:
-		host_status = XEN_VSCSIIF_RSLT_HOST_ALLOC_FAILURE;
-		break;
-	case DID_MEDIUM_ERROR:
-		host_status = XEN_VSCSIIF_RSLT_HOST_MEDIUM_ERROR;
-		break;
 	case DID_TRANSPORT_MARGINAL:
 		host_status = XEN_VSCSIIF_RSLT_HOST_TRANSPORT_MARGINAL;
 		break;
diff --git a/include/xen/interface/io/vscsiif.h b/include/xen/interface/io/vscsiif.h
index 7ea4dc9611c4..44eb1f34f1a0 100644
--- a/include/xen/interface/io/vscsiif.h
+++ b/include/xen/interface/io/vscsiif.h
@@ -316,16 +316,8 @@  struct vscsiif_response {
 #define XEN_VSCSIIF_RSLT_HOST_TRANSPORT_DISRUPTED 14
 /* Transport class fastfailed */
 #define XEN_VSCSIIF_RSLT_HOST_TRANSPORT_FAILFAST  15
-/* Permanent target failure */
-#define XEN_VSCSIIF_RSLT_HOST_TARGET_FAILURE      16
-/* Permanent nexus failure on path */
-#define XEN_VSCSIIF_RSLT_HOST_NEXUS_FAILURE       17
-/* Space allocation on device failed */
-#define XEN_VSCSIIF_RSLT_HOST_ALLOC_FAILURE       18
-/* Medium error */
-#define XEN_VSCSIIF_RSLT_HOST_MEDIUM_ERROR        19
 /* Transport marginal errors */
-#define XEN_VSCSIIF_RSLT_HOST_TRANSPORT_MARGINAL  20
+#define XEN_VSCSIIF_RSLT_HOST_TRANSPORT_MARGINAL  16
 
 /* Result values of reset operations */
 #define XEN_VSCSIIF_RSLT_RESET_SUCCESS  0x2002