Bug 748902

Summary: qemu fails on disk with 4k sectors and cache=off
Product: [Fedora] Fedora Reporter: Matthew Booth <mbooth>
Component: qemuAssignee: Fedora Virtualization Maintainers <virt-maint>
Status: CLOSED DEFERRED QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 15CC: amit.shah, berrange, crobinso, dougsland, dwmw2, ehabkost, itamar, jaswinder, jforbes, juzhang, knoel, scottt.tw, tburke, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 748906 (view as bug list) Environment:
Last Closed: 2012-05-29 00:32:29 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 748906, 749122    

Description Matthew Booth 2011-10-25 14:29:08 UTC
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):
qemu-system-x86-0.14.0-8.fc15.x86_64

How reproducible:
100%

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
  
Actual results:
This will fail almost immediately in pvcreate.

Expected results:
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).

Comment 1 Fedora Admin XMLRPC Client 2012-03-15 17:54:20 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 2 Cole Robinson 2012-05-29 00:32:29 UTC
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.