On Tue, Jan 17, 2017 at 08:33:46AM +0100, Alexandre DERUMIER wrote: > Hi, > > proxmox users have reported recently corruption with qemu 2.7 and scsi-block > (with passing physical /dev/sdX to virtio-scsi). > > working fine with qemu 2.6. > > qemu 2.7 + scsi-hd works fine > > https://forum.proxmox.com/threads/proxmox-4-4-virtio_scsi-regression.31471/page-2 >
I am fairly sure this is a separate issue. Commit 8fdc7839e40f43a426bc7e858cf1dbfe315a3804 (first included in 2.7.0)[1] changed the behaviour of scsi-block passthrough. Previously this worked with SATA disks, now it doesn't anymore. A bisect run confirmed this, scsi-block with a SATA disk passed through via virtio-scsi-single corrupts on writes since that commit, scsi-hd and scsi-disk work fine (scsi-generic corrupts as well). PVE's detection logic for passthrough just differentiated between disks and tape drives, and unfortunately the SG_IO ioctl says SATA disks are disks as well.. we probably need to default to scsi-hd or scsi-disk instead of scsi-block, and only when we explicitly detect a "real" SCSI disk we are allowed to use scsi-block? @Paolo: was the old behaviour just an accident and the new bevaviour intentional? documentation is quite sparse, or maybe I am looking in the wrong places.. 1: scsi-block: always use SG_IO Using pread/pwrite or io_submit has the advantage of eliminating the bounce buffer, but drops the SCSI status. This keeps the guest from seeing unit attention codes, as well as statuses such as RESERVATION CONFLICT. Because we know scsi-block operates on an SBC device we can still use the DMA helpers with SG_IO; just remember to patch the CDBs if the transfer is split into multiple segments. This means that scsi-block will always use the thread-pool unfortunately, instead of respecting aio=native. Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>