Bug 587604 - Qcow2 snapshot got corruption after commit using block device
Summary: Qcow2 snapshot got corruption after commit using block device
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kvm
Version: 5.6
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Kevin Wolf
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: Rhel5KvmTier1
TreeView+ depends on / blocked
 
Reported: 2010-04-30 11:14 UTC by Qunfang Zhang
Modified: 2013-01-11 02:58 UTC (History)
9 users (show)

Fixed In Version: kvm-83-181.el5
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 589439 (view as bug list)
Environment:
Last Closed: 2011-01-13 23:35:14 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2011:0028 0 normal SHIPPED_LIVE Low: kvm security and bug fix update 2011-01-13 11:03:39 UTC

Description Qunfang Zhang 2010-04-30 11:14:52 UTC
Description of problem:
Install a RHEL5.5-64 guest on block device then create snapshot chains with files written inside both snapshots.
base --> sn1(create a file) --> sn2(create another file)
then commit sn2 to sn1, unfortunately, sn1 got corruption and can not boot sn1 and sn2.
If without write some files inside snapshots, directly create sn1 and sn2 then commit sn2, all snapshots work well.

PS: When testing on my local host disk using file storage instead of block device, this issue does not exist.

Version-Release number of selected component (if applicable):
kvm-83-172.el5
2.6.18-194.el5

How reproducible:
100%

Steps to Reproduce:
1. login block device.
iscsiadm --mode node --targetname iqn.redhat.com:disk1.s2 --portal 10.66.65.191:3260,1 --login
2.fdisk /dev/sdb
3.mkfs.ext3 /dev/sdb1
4.vgcreate vgtest172 /dev/sdb1
5.lvcreate -n lv-172-base -L 80G vgtest172
6.qemu-img create -f qcow2 /dev/vgtest172/lv-172-base 80G
7./usr/libexec/qemu-kvm -no-hpet -usbdevice tablet -rtc-td-hack -no-kvm-pit-reinjection -startdate now -drive file=/root/Desktop/RHEL5.5-Server-20100322.0-x86_64-DVD.iso,media=cdrom,index=2 -drive file=/dev/vgtest172/lv-172-base,media=disk,format=qcow2,if=ide,cache=off,index=0,werror=stop -net nic,vlan=0,macaddr=10:1a:4a:10:11:40,model=e1000 -net tap,vlan=0,script=/etc/qemu-ifup -cpu qemu64,+sse2 -balloon none -vnc :10 -uuid `uuidgen` -monitor stdio -m 2G -smp 2 -boot dc -notify all

8. create sn1 and write some files in sn1.
#lvcreate -n lv-sn1 -L 80G vgtest172
#qemu-img create -f qcow2 -F qcow2 -b /dev/vgtest172/lv-172-base /dev/vgtest172/lv-sn1
#boot sn1 with the same command line and write 5G file in it, then shutdown sn2.

9.create sn2 and write some files in sn2,the same steps as above.

10.commit sn2.
#qemu-img commit -f qcow2 /dev/vgtest172/lv-sn3


Actual results:
Result:
Can not boot sn1 and sn2, the sn1 snapshot got corruption.

/usr/libexec/qemu-kvm -no-hpet -usbdevice tablet -rtc-td-hack -no-kvm-pit-reinjection -startdate now -net nic,vlan=0,macaddr=10:1a:4a:10:11:40,model=e1000 -net tap,vlan=0,script=/etc/qemu-ifup -cpu qemu64,+sse2 -balloon none -vnc :10 -uuid 1a98f19b-7f3b-4c15-8747-4a4b173d772f -monitor stdio -m 2G -smp 2 -boot c -notify all -drive file=/dev/vgtest172/lv-sn1,media=disk,if=ide,cache=off,format=qcow2,index=0,werror=stop

qemu: could not open disk image /dev/vgtest172/lv-sn1

Expected results:
Snapshot sn1 can be boot up successfully and the file created in sn2 is committed to sn1.

Additional info:

#hexdump -C -n 1024 /dev/vgtest172/lv-sn1 | less

00000000 eb 48 90 10 8e d0 bc 00 b0 b8 00 00 8e d8 8e c0 |.H..............|
00000010 fb be 00 7c bf 00 06 b9 00 02 f3 a4 ea 21 06 00 |...|.........!..|
00000020 00 be be 07 38 04 75 0b 83 c6 10 81 fe fe 07 75 |....8.u........u|
00000030 f3 eb 16 b4 02 b0 01 bb 00 7c b2 80 8a 74 03 02 |.........|...t..|
00000040 80 00 00 80 41 74 02 00 00 08 fa 90 90 f6 c2 80 |....At..........|
00000050 75 02 b2 80 ea 59 7c 00 00 31 c0 8e d8 8e d0 bc |u....Y|..1......|
00000060 00 20 fb a0 40 7c 3c ff 74 02 88 c2 52 be 7f 7d |. ..@|<.t...R..}|
00000070 e8 34 01 f6 c2 80 74 54 b4 41 bb aa 55 cd 13 5a |.4....tT.A..U..Z|
00000080 52 72 49 81 fb 55 aa 75 43 a0 41 7c 84 c0 75 05 |RrI..U.uC.A|..u.|
00000090 83 e1 01 74 37 66 8b 4c 10 be 05 7c c6 44 ff 01 |...t7f.L...|.D..|
000000a0 66 8b 1e 44 7c c7 04 10 00 c7 44 02 01 00 66 89 |f..D|.....D...f.|
000000b0 5c 08 c7 44 06 00 70 66 31 c0 89 44 04 66 89 44 |\..D..pf1..D.f.D|
000000c0 0c b4 42 cd 13 72 05 bb 00 70 eb 7d b4 08 cd 13 |..B..r...p.}....|
000000d0 73 0a f6 c2 80 0f 84 ea 00 e9 8d 00 be 05 7c c6 |s.............|.|
000000e0 44 ff 00 66 31 c0 88 f0 40 66 89 44 04 31 d2 88 |D..f1....1..|
000000f0 ca c1 e2 02 88 e8 88 f4 40 89 44 08 31 c0 88 d0 |........@.D.1...|
00000100 c0 e8 02 66 89 04 66 a1 44 7c 66 31 d2 66 f7 34 |...f..f.D|f1.f.4|
00000110 88 54 0a 66 31 d2 66 f7 74 04 88 54 0b 89 44 0c |.T.f1.f.t..T..D.|
00000120 3b 44 08 7d 3c 8a 54 0d c0 e2 06 8a 4c 0a fe c1 |;D.}<.T.....L...|
00000130 08 d1 8a 6c 0c 5a 8a 74 0b bb 00 70 8e c3 31 db |...l.Z.t...p..1.|
00000140 b8 01 02 cd 13 72 2a 8c c3 8e 06 48 7c 60 1e b9 |.....r*....H|`..|
00000150 00 01 8e db 31 f6 31 ff fc f3 a5 1f 61 ff 26 42 |....1.1.....a.&B|
00000160 7c be 85 7d e8 40 00 eb 0e be 8a 7d e8 38 00 eb ||..}.@.....}.8..|
00000170 06 be 94 7d e8 30 00 be 99 7d e8 2a 00 eb fe 47 |...}.0...}.*...G|
00000180 52 55 42 20 00 47 65 6f 6d 00 48 61 72 64 20 44 |RUB .Geom.Hard D|
00000190 69 73 6b 00 52 65 61 64 00 20 45 72 72 6f 72 00 |isk.Read. Error.|
000001a0 bb 01 00 b4 0e cd 10 ac 3c 00 75 f4 c3 00 00 00 |........<.u.....|
000001b0 00 00 00 00 00 00 00 00 2f 97 05 00 00 00 80 01 |......../.......|
000001c0 01 00 83 fe 3f 0c 3f 00 00 00 8e 2f 03 00 00 00 |....?.?..../....|
000001d0 01 0d 8e fe ff ff cd 2f 03 00 3e bb fc 09 00 00 |......./..>.....|
000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|

Comment 1 Qunfang Zhang 2010-04-30 11:36:36 UTC
Re-test in kvm-83-170.el5 with the same steps, passed.

Comment 2 Kevin Wolf 2010-04-30 12:06:57 UTC
I'm not sure what happens here, but the again, the only change between 170 and 172 is the read-only support. It did touch the commit function, so something might have gone wrong there (maybe guessing the image format for bdrv_open2 is a bad idea?)

CCing Napthali to have a look at it.

Comment 7 Qunfang Zhang 2010-05-18 03:11:10 UTC
Verified on kvm-83-181.el5, passed.

Comment 8 Eduardo Habkost 2010-05-18 15:17:51 UTC
Fixing Rhel5KvmTier1 dependency.

Comment 11 Qunfang Zhang 2010-11-02 07:14:38 UTC
Verified on kvm-83-207.el5 according to the steps in bug description. And this issue does not exist. So change the status to VERIFIED.

Comment 13 errata-xmlrpc 2011-01-13 23:35:14 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-0028.html


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