scsi: move host_status handling into SCSI drivers

Some SCSI drivers like virtio have an internal mapping for the
host_status. This patch moves the host_status translation into
the SCSI drivers to allow those drivers to set up the correct
values.

Signed-off-by: Hannes Reinecke <hare@suse.de>.
[Added default handling to avoid touching all drivers. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Hannes Reinecke 2021-02-24 19:14:50 +01:00 committed by Paolo Bonzini
parent a108557bbf
commit f3126d65b3
6 changed files with 128 additions and 13 deletions

View file

@ -89,10 +89,8 @@ static void scsi_command_complete_noio(SCSIGenericReq *r, int ret)
scsi_req_build_sense(&r->req, sense);
}
} else if (io_hdr->host_status != SCSI_HOST_OK) {
status = scsi_sense_from_host_status(io_hdr->host_status, &sense);
if (status == CHECK_CONDITION) {
scsi_req_build_sense(&r->req, sense);
}
scsi_req_complete_failed(&r->req, io_hdr->host_status);
goto done;
} else if (io_hdr->driver_status & SG_ERR_DRIVER_TIMEOUT) {
status = BUSY;
} else {