Bug 688147

Summary: qcow2: Reads fail with backing file smaller than snapshot
Product: Red Hat Enterprise Linux 6 Reporter: Kevin Wolf <kwolf>
Component: qemu-kvmAssignee: Kevin Wolf <kwolf>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.1CC: ehabkost, juzhang, mkenneth, tburke, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-0.12.1.2-2.151.el6 Doc Type: Bug Fix
Doc Text:
Cause: For a QCOW2 image that is larger than its base image, when handling a read request straddling over the end of the base image, the QCOW2 driver attempts to read beyond the end of the base image. Consequence: I/O requests that should have succeeded failed. Fix: qcow2 code changed to properly handle read base image beyond its size. Result: when using a QCOW2 image that is larger than its base image, when handling a read request straddling over the end of the base image, I/O will succeed.
Story Points: ---
Clone Of:
: 698924 (view as bug list) Environment:
Last Closed: 2011-05-19 11:21:21 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: 698924    

Description Kevin Wolf 2011-03-16 13:22:27 UTC
For a QCOW2 image that is larger than its base image, when handling a read request straddling over the end of the base image, the QCOW2 driver attempts to read beyond the end of the base image and the request would fail.

Comment 2 juzhang 2011-03-17 12:06:29 UTC
Can reproduce this issue with qemu-kvm-0.12.1.2-2.149.el6.x86_64.
step
1. create a base.qcow2 with 64 MB and a sn1.qcow2 with 128 MB and base.qcow2 as its backing file
#qemu-img create -f qcow2 base.qcow2 64M
#qemu-img create -f qcow2 -b base.qcow2 sn1.qcow2 128M

2.read data in sn1.qcow2
#qemu-io -c 'read -v 63M 2M' sn1.qcow2

Results:
Found lots of "0xab instead of 0x00"

040ffe20:  ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab  ................
040ffe30:  ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab  ................
040ffe40:  ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab  ................
040ffe50:  ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab  ................
040ffe60:  ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab  ................
040ffe70:  ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab  ................
040ffe80:  ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab  ................
040ffe90:  ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab  ................
040ffea0:  ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab  ................
040ffeb0:  ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab  ................
040ffec0:  ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab  ................
040ffed0:  ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab  ................
040ffee0:  ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab  ................
040ffef0:  ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab  ................
040fff00:  ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab  ................
040fff10:  ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab  ................

Comment 3 juzhang 2011-03-17 12:07:16 UTC
according to comment2,set qa_ack

Comment 7 juzhang 2011-03-30 06:29:40 UTC
Verified using steps as same as comment2 with qemu-kvm-0.12.1.2-2.153.el6.x86_64

After step2

results:
all "0x00" even read big than backing file

.......................................
040fff50:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
040fff60:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
040fff70:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
040fff80:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
040fff90:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
040fffa0:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
040fffb0:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
040fffc0:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
040fffd0:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
040fffe0:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
040ffff0:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
read 2097152/2097152 bytes at offset 66060288
2 MiB, 1 ops; 0.0000 sec (10.851 GiB/sec and 5555.5556 ops/sec)

Comment 8 juzhang 2011-03-30 06:31:12 UTC
According to comment7,set this issue status as verified.

Comment 9 Eduardo Habkost 2011-05-03 19:17:26 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause: For a QCOW2 image that is larger than its base image, when handling a read request straddling over the end of the base image, the QCOW2 driver attempts to read beyond the end of the base image.

Consequence: I/O requests that should have succeeded failed.

Fix: qcow2 code changed to properly handle read base image beyond its size.

Result: when using a QCOW2 image that is larger than its base image, when handling a read request straddling over the end of the base image, I/O will succeed.

Comment 10 errata-xmlrpc 2011-05-19 11:21:21 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0534.html

Comment 11 errata-xmlrpc 2011-05-19 13:02:23 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0534.html