Skip to content

Commit

Permalink
scsi: xen-scsifront: Compability status handling
Browse files Browse the repository at this point in the history
The Xen guest might run against arbitrary backends, so the driver might
receive a status with driver_byte set. Map these errors to DID_ERROR to be
consistent with recent changes.

Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Hannes Reinecke <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
  • Loading branch information
hreinecke authored and martinkpetersen committed Jun 1, 2021
1 parent 58bedf3 commit b840abe
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/scsi/xen-scsifront.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ static void scsifront_cdb_cmd_done(struct vscsifrnt_info *info,
struct scsi_cmnd *sc;
uint32_t id;
uint8_t sense_len;
int result;

id = ring_rsp->rqid;
shadow = info->shadow[id];
Expand All @@ -261,7 +262,12 @@ static void scsifront_cdb_cmd_done(struct vscsifrnt_info *info,
scsifront_gnttab_done(info, shadow);
scsifront_put_rqid(info, id);

sc->result = ring_rsp->rslt;
result = ring_rsp->rslt;
if (result >> 24)
set_host_byte(sc, DID_ERROR);
else
set_host_byte(sc, host_byte(result));
set_status_byte(sc, result & 0xff);
scsi_set_resid(sc, ring_rsp->residual_len);

sense_len = min_t(uint8_t, VSCSIIF_SENSE_BUFFERSIZE,
Expand Down

0 comments on commit b840abe

Please sign in to comment.