The scsi_sense_from_host_status() always returns GOOD since req->host_status is 255 (-1) at this time. Change req->host_status to host_status so that scsi_sense_from_host_status() will be able to return the expected value.
Fixes: f3126d65b393("scsi: move host_status handling into SCSI drivers") Cc: Joe Jin <joe....@oracle.com> Signed-off-by: Dongli Zhang <dongli.zh...@oracle.com> --- hw/scsi/scsi-bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index 77325d8cc7..d46650bd8c 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -1465,7 +1465,7 @@ void scsi_req_complete_failed(SCSIRequest *req, int host_status) assert(req->ops != &reqops_unit_attention); if (!req->bus->info->fail) { - status = scsi_sense_from_host_status(req->host_status, &sense); + status = scsi_sense_from_host_status(host_status, &sense); if (status == CHECK_CONDITION) { scsi_req_build_sense(req, sense); } -- 2.17.1