Red Hat Bugzilla – Bug 748902
qemu fails on disk with 4k sectors and cache=off
Last modified: 2015-02-27 22:14:44 EST
Description of problem:
qemu returns numerous read errors when run with a file-backed disk which is stored on a disk with 4k physical sectors. The underlying cause of these read errors is pread() returning EINVAL in handle_aiocb_rw_linear(). Configuring the appliance to not use cache=off makes the problem go away.
By default, qemu seems to be aligning reads to 512 bytes. This fails for a file opened with O_DIRECT when the sector size is 4096 bytes. Disks with 4k sectors are only just starting to come to the market.
# fdisk -l /dev/vg_dellper30001/lv_home
Note: sector size is 4096 (not 512)
Disk /dev/vg_dellper30001/lv_home: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 81 cylinders, total 1310720 sectors
Units = sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Version-Release number of selected component (if applicable):
Steps to Reproduce:
I hit the problem with libguestfs. If you have a libguestfs source tree, and a physical disk with 4k sectors, after configure and make, run:
make -C images check
This will fail almost immediately in pvcreate.
qemu should check the sector size with the appropriate ioctl rather than using a hard-coded value of 512 bytes. It should Just Work(TM).
This package has changed ownership in the Fedora Package Database. Reassigning to the new owner of this component.
Hmm, according to bug 608548, upstream has fixes and they should be in F15's qemu version. Maybe there was a missing piece?
Either way F15 is end of life pretty soon, so closing. mbooth, if this is still an issue in newer fedora, please reopen and we can go from there.