On 11/21/19 4:30 AM, Stefan Hajnoczi wrote: > blkdebug can inject EIO when a specific LBA is accessed. Is that > enough for what you want to do? Then you can reuse and maybe extend > blkdebug.
Not exactly. For SCSI, I would like to be able to return different types of device errors on reads eg. 03/1101, 03/1600 and writes. The SCSI sense data needs to include the first block in error for the transfer. It would be good to also have the ability to include things like SCSI check conditions with recoverable errors too. I've been experimenting with blkdebug, to learn more and to see how it would need to be extended. One thing that I was trying to understand is how an EIO from blkdebug gets translated into a bus/device specific error. At the moment I'm not sure. I've been trying to figure out the layering. I think that blkdebug sits between the device specific model and the underlying block representation on disk. Thus it injects error return values when accessing the underlying data, but that could be incorrect. If it is correct I should see some code that translates the EIO to something transport/device specific. Although I don't understand how returning an ENOSPC from read_aio in blkdebug would get translated for a SCSI disk as it doesn't make sense to me (one of the examples in the documentation). Actually I don't know how getting ENOSPC on a read could happen? During my blkdebug experimentation, I've been using lsi53c895a with scsi-disk and thus far I've not been able to generate a read error back to the guest kernel. I've managed to abort qemu with an assert and hang qemu without being able to get an error back to the guest kernel. I wrote up one of them: https://bugs.launchpad.net/qemu/+bug/1853898 . Specifying a specific sector hasn't worked for me yet. I'm still trying to figure out how to enable tracing/debugging etc. to see what I'm going incorrectly. If someone can point me to any relevant docs, diagrams, talks etc. that would be greatly appreciated. I've been looking in the source tree docs directory and the source code itself and things I've found from web searches. Thanks, Tony