On 7/1/19 8:56 PM, Paolo Bonzini wrote: > On 01/07/19 12:14, Shinichiro Kawasaki wrote: >> I observe four of them listed below in sense data, >> when I ran basic operations to the zoned storage from the guest via >> scsi-block. >> >> 21h 04h: UNALIGNED WRITE COMMAND >> 21h 05h: WRITE BOUNDARY VIOLATION >> 21h 06h: ATTEMPT TO READ INVALID DATA >> 55h 0Eh: INSUFFICIENT ZONE RESOURCES >> >> These ASCs can be reported for write or read commands due to unexpected zone >> status or write pointer status. Reporting these ASCs to the guest, the user >> applications can handle them to manage zone/write pointer status, or help the >> user application developers to understand the failure reason and fix bugs. >> >> I took a look in scsi_sense_to_errno() and learned that ASCs are grouped in >> errnos. To report the ASCs above to the guest, is it good to add them in >> EINVAL >> group defined in scsi_sense_to_errno()? The ASCs are reported with sense key >> ILLEGAL_REQUEST or DATA_PROTECT, then I think it fits in the function. > > The grouping by errno is historical and pretty much broken. It should > be possible to change it to return just a bool.
The errno grouping of scsi_sense_to_errno() is used not only by scsi-disk but also by block/iscsi for error reporting. Can we avoid errno grouping for iscsi also? If the errno grouping is not valuable for iscsi, single error code (EIO?) can be reported for all iscsi failures. If the errno grouping is useful for iscsi, I can create a patch to avoid errno grouping only for scsi-disk, leaving scsi_sense_to_errno() for iscsi. -- Best Regards, Shin'ichiro Kawasaki