On 06/01/2016 18:57, John Snow wrote: > Ronnie: Thanks for the explanation! > > Zhu: In light of this, can the patch be reworked slightly to explicitly > check *why* READCAPACITY16 failed and only attempt the READCAPACITY10 as > a fallback if it receives INVALID_OPCODE? > > If it fails for any other reason it's probably best to report the error > and let QEMU decide what to do about it.
Any other failure probably would happen for READ CAPACITY(10) as well, so it's okay to ignore it for READ CAPACITY(16). Zhu's patch matches what Linux does by default, it seems okay. The only change needed is to retry READ CAPACITY(16) if there is a UNIT ATTENTION sense: + if (task != NULL && task->status == SCSI_STATUS_CHECK_CONDITION + && task->sense.key == SCSI_SENSE_UNIT_ATTENTION) { + break; + } Paolo