Bug 1167249 - qemu-img disk corruption
Summary: qemu-img disk corruption
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: qemu
Version: 21
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Fedora Virtualization Maintainers
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-11-24 09:58 UTC by Tony Breeds
Modified: 2014-12-12 04:26 UTC (History)
11 users (show)

Fixed In Version: qemu-2.1.2-7.fc21
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-12-12 04:26:43 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Launchpad 1368815 0 None None None Never
Red Hat Bugzilla 1142331 0 high CLOSED qemu-img convert intermittently corrupts output images 2021-02-22 00:41:40 UTC

Description Tony Breeds 2014-11-24 09:58:13 UTC
Description of problem:
When using qemu-img convert to/from raw format on files that are not fully flushed to disk corrupt disk images can result.

Version-Release number of selected component (if applicable):

Affects F19 F20 and F21.  Fixed in rawhide.

I know it's a little tacky to point to another distro's bug tracker but please see the ubuntu bug referenced below.

It contains the patches to backport to the affected current releases.

Comment 1 Richard W.M. Jones 2014-11-24 10:23:49 UTC
I've seen something like this with virt-builder, which required
virt-builder to fsync the image after writing it.  In fact
we document it.  Search the following page for '--no-sync':

http://libguestfs.org/virt-builder.1.html

Comment 2 Richard W.M. Jones 2014-11-24 10:24:57 UTC
BTW I think your explanation in the launchpad bug may be wrong
(or maybe there are two separate issues).  The issue we had is
that the default cache mode in qemu is directsync (using O_DIRECT)
so it bypasses the cache, and using qemu-img before or after qemu
causes it to not read data which is cached and not written to disk.

Comment 3 Tony Breeds 2014-11-24 10:59:46 UTC
I'm pretty sure there are 2 issues.  I've certainly see the issue you describe above, but not in an openstack context.

In our case the source image is fine. and NOT controlled by qemu (at this point) so it's pretty easy to rule out qemu's cacheing or IO models.

Comment 4 Tony Breeds 2014-11-24 11:01:09 UTC
FWIW I've included a link to the RHEL bug for this issue.

Comment 5 Cole Robinson 2014-11-25 15:35:30 UTC
From https://bugs.launchpad.net/qemu/+bug/1368815/comments/8:

FWIW the following 2 commits in qemu master resolve the issue for qemu-img.

  http://git.qemu.org/?p=qemu.git;a=commit;h=38c4d0aea3e1264c86e282d99560330adf2b6e25
  http://git.qemu.org/?p=qemu.git;a=commit;h=7c15903789953ead14a417882657d52dc0c19a24

If possible they should be back ported to trusty and utopic.

You'll also need something like:

  http://git.qemu.org/?p=qemu.git;a=commit;h=4f11aa8a40351b28c0e67c7276e0003b38cc46ac

before my 2 patches.

Comment 6 Fedora Update System 2014-12-01 15:24:29 UTC
qemu-2.1.2-7.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/qemu-2.1.2-7.fc21

Comment 7 Fedora Update System 2014-12-02 01:03:55 UTC
Package qemu-2.1.2-7.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing qemu-2.1.2-7.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-16075/qemu-2.1.2-7.fc21
then log in and leave karma (feedback).

Comment 8 Pádraig Brady 2014-12-02 10:55:43 UTC
Updated package works on F21.
I've confirmed the fiemap code issue affects F19 and F20 also

Comment 9 Fedora Update System 2014-12-12 04:26:43 UTC
qemu-2.1.2-7.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.