Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: xen: Drop use of internal host codes

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 the SCSI midlayer then it
kicks off the error handler which is definitely not what we want.

Remove the use from xen-scsifront/back.

Link: https://lore.kernel.org/r/20220812010027.8251-2-michael.christie@oracle.com
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Mike Christie and committed by
Martin K. Petersen
00903af9 e699bb97

-20
-8
drivers/scsi/xen-scsifront.c
··· 289 289 return DID_TRANSPORT_DISRUPTED; 290 290 case XEN_VSCSIIF_RSLT_HOST_TRANSPORT_FAILFAST: 291 291 return DID_TRANSPORT_FAILFAST; 292 - case XEN_VSCSIIF_RSLT_HOST_TARGET_FAILURE: 293 - return DID_TARGET_FAILURE; 294 - case XEN_VSCSIIF_RSLT_HOST_NEXUS_FAILURE: 295 - return DID_NEXUS_FAILURE; 296 - case XEN_VSCSIIF_RSLT_HOST_ALLOC_FAILURE: 297 - return DID_ALLOC_FAILURE; 298 - case XEN_VSCSIIF_RSLT_HOST_MEDIUM_ERROR: 299 - return DID_MEDIUM_ERROR; 300 292 case XEN_VSCSIIF_RSLT_HOST_TRANSPORT_MARGINAL: 301 293 return DID_TRANSPORT_MARGINAL; 302 294 default:
-12
drivers/xen/xen-scsiback.c
··· 333 333 case DID_TRANSPORT_FAILFAST: 334 334 host_status = XEN_VSCSIIF_RSLT_HOST_TRANSPORT_FAILFAST; 335 335 break; 336 - case DID_TARGET_FAILURE: 337 - host_status = XEN_VSCSIIF_RSLT_HOST_TARGET_FAILURE; 338 - break; 339 - case DID_NEXUS_FAILURE: 340 - host_status = XEN_VSCSIIF_RSLT_HOST_NEXUS_FAILURE; 341 - break; 342 - case DID_ALLOC_FAILURE: 343 - host_status = XEN_VSCSIIF_RSLT_HOST_ALLOC_FAILURE; 344 - break; 345 - case DID_MEDIUM_ERROR: 346 - host_status = XEN_VSCSIIF_RSLT_HOST_MEDIUM_ERROR; 347 - break; 348 336 case DID_TRANSPORT_MARGINAL: 349 337 host_status = XEN_VSCSIIF_RSLT_HOST_TRANSPORT_MARGINAL; 350 338 break;