On 6/15/21 4:59 AM, Martin K. Petersen wrote: > > Hannes, > >> When a sense code is present we should not override the scsi status; >> the driver already sets it based on the response from the hypervisor. > > Color me confused. The code looks like this: > > if (sc->sense_buffer) { > memcpy(sc->sense_buffer, resp->sense, > min_t(u32, > virtio32_to_cpu(vscsi->vdev, resp->sense_len), > VIRTIO_SCSI_SENSE_SIZE)); > set_status_byte(sc, SAM_STAT_CHECK_CONDITION); > } > > But sc->sense_buffer is always true, the scsi_cmnd obviously has a sense > buffer. > > Shouldn't that be looking at the returned response instead? > > if (resp->sense_len) { > memcpy(sc->sense_buffer, resp->sense, > min_t(u32, > virtio32_to_cpu(vscsi->vdev, resp->sense_len), > VIRTIO_SCSI_SENSE_SIZE)); > set_status_byte(sc, SAM_STAT_CHECK_CONDITION); > } > > What am I missing? > Indeed, you are right. Will be fixing it up. Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@xxxxxxx +49 911 74053 688 SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), GF: Felix Imendörffer