Bug 638055
Summary: | Allow qemu-img re-base with undersized backing files | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 6 | Reporter: | Shirley Zhou <szhou> |
Component: | qemu-kvm | Assignee: | Kevin Wolf <kwolf> |
Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
Severity: | medium | Docs Contact: | |
Priority: | low | ||
Version: | 6.0 | CC: | areis, juzhang, kwolf, lihuang, minovotn, mkenneth, mshao, shu, sluo, tburke, virt-maint, wdai |
Target Milestone: | beta | ||
Target Release: | 6.2 | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | qemu-kvm-0.12.1.2-2.237.el6 | Doc Type: | Bug Fix |
Doc Text: |
Cause:
qemu-img rebase assumed in safe mode that backing files have the same size as the rebased image. This is not true, they may be smaller and the rest of the image is considered to be backed by sectors filled with zeros.
Consequence:
Rebase an image, where the old or the new backing file is smaller than the image itself. In order to compare its content to the backing files, qemu-img tries to read after the end of the backing file and fails with error message "qemu-img: error while reading from new backing file"
Fix:
Before reading a sector from the new or old backing file for comparison, check if it is even contained in the backing file and use a sector of zeros otherwise.
Result:
qemu-img rebase succeeds even with backing files that are smaller than the rebased image.
|
Story Points: | --- |
Clone Of: | Environment: | ||
Last Closed: | 2012-06-20 11:32:28 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: | 580953 |
Description
Shirley Zhou
2010-09-28 04:51:54 UTC
Actually, I think it shouldn't abort. If I remember correctly, it's legal to have a snapshot that is larger than its backing file. Probably not a common use case, though. In function bdrv_check_byte_request, it will check validity of parameter len and size, for this bug, it return -EIO, the rebase will end with error "error while reading from new backing file". if ((offset > len) || (len - offset < size)) return -EIO; When create snapshot for backing file, the size of snapshot is equal to backing file, when rebase to new disk,the size of new disk may be smaller than backing file, at that time, the error is acceptable. But the error should be show up before rebase start,it should not prompt after write 29G file. QE prefer to compare size of backing file and new disk before rebase. Thanks. I have reproduced this issue on qemu-kvm-0.12.1.2-2.236.el6.x86_64 and verified this issue on qemu-kvm-0.12.1.2-2.237.el6.x86_64 with the same steps. The result of reproduce is that a error prompts after rebase snapshot C to the new base image: # qemu-img rebase -b base_new.qcow2 -f qcow2 -F qcow2 C qemu-img: error while reading from new backing file The result of verify is that rebase snapshot C to the new base image successfully. # qemu-img rebase -b base_new.qcow2 -f qcow2 -F qcow2 C # qemu-img info C image: C file format: qcow2 virtual size: 20G (21474836480 bytes) disk size: 3.2G cluster_size: 65536 backing file: base_new.qcow2 (actual path: base_new.qcow2) Above all, this issue has been fixed. 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: Create several snapshots of a backing image and rebase one of them to higher size than the backing file. Consequence: qemu-img fails with error message "qemu-img: error while reading from new backing file" Fix: Rebase backing image as well and fill sectors after the end of original backing file by zeros. Result: File is being rebased to the new size. Technical note updated. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. Diffed Contents: @@ -1,11 +1,11 @@ Cause: -Create several snapshots of a backing image and rebase one of them to higher size than the backing file. +qemu-img rebase assumed in safe mode that backing files have the same size as the rebased image. This is not true, they may be smaller and the rest of the image is considered to be backed by sectors filled with zeros. Consequence: -qemu-img fails with error message "qemu-img: error while reading from new backing file" +Rebase an image, where the old or the new backing file is smaller than the image itself. In order to compare its content to the backing files, qemu-img tries to read after the end of the backing file and fails with error message "qemu-img: error while reading from new backing file" Fix: -Rebase backing image as well and fill sectors after the end of original backing file by zeros. +Before reading a sector from the new or old backing file for comparison, check if it is even contained in the backing file and use a sector of zeros otherwise. Result: -File is being rebased to the new size.+qemu-img rebase succeeds even with backing files that are smaller than the rebased image. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2012-0746.html |