Red Hat Bugzilla – Bug 856505
Missing error message in bdrv_commit to read-only backing file
Last modified: 2013-11-21 00:52:20 EST
Description of problem: Boot up a guest with a image with parameter snapshot=on, readonly=on. Write in the image inside guest, then commit it to the backing files in monitor. The commit will success without any error message. But in fact the backing image is readonly and the commit is not saved in the image files. Version-Release number of selected component (if applicable): host kernel: 2.6.32-303.el6.x86_64 # rpm -qa |grep qemu qemu-kvm-tools-0.12.1.2-2.309.el6.x86_64 gpxe-roms-qemu-0.9.7-6.9.el6.noarch qemu-guest-agent-0.12.1.2-2.309.el6.x86_64 qemu-kvm-0.12.1.2-2.309.el6.x86_64 qemu-kvm-debuginfo-0.12.1.2-2.309.el6.x86_64 qemu-img-0.12.1.2-2.309.el6.x86_64 How reproducible: always Steps to Reproduce: 1. boot up guest with a data image and set the image parameter like this: ...,readonly=on,snapshot=on 2. dd a file in the guest to the data image set to readonly 3. do commit in monitor Actual results: commit will not return error message Expected results: commit return an error message mentioned that backing image is readonly Additional info: 1. host cpu processor : 3 vendor_id : GenuineIntel cpu family : 6 model : 23 model name : Intel(R) Core(TM)2 Quad CPU Q9400 @ 2.66GHz stepping : 10 cpu MHz : 1998.000 cache size : 3072 KB physical id : 0 siblings : 4 core id : 2 cpu cores : 4 apicid : 2 initial apicid : 2 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm dts tpr_shadow vnmi flexpriority bogomips : 5333.08 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management:
I tried the rhel7 aslo hit this issue, clone it to rhel7 for fixing, please correct me if any error.
In bdrv_commit(), we are (appropriately) refusing to write to the backing file (in this case, the top-level snapshot, as the active layer is a temp image). The function bdrv_reopen() returns an error, and bdrv_commit() returns -EACCES. However, do_commit(), which is the message handler that calls bdrv_commit(), only checks for -EBUSY when it comes to returning an error message.
Patch submitted upstream: https://lists.gnu.org/archive/html/qemu-devel/2013-01/msg03456.html
Reproduce with qemu-kvm-0.12.1.2-2.394.el6.x86_64 Steps to Reproduce: 1. Boot a guest: .... -drive file=/home/RHEL6.5-64-0905.qcow2,if=none,id=drive-system-disk,media=disk,format=qcow2,aio=native,werror=stop,rerror=stop,snapshot=on,readonly=on -device virtio-blk-pci,scsi=on,bus=pci.0,drive=drive-system-disk,id=system-disk,bootindex=1,addr=0x5 ................... 2. Create big file in guest: dd if=/dev/zero of=dd_1G bs=1M count=1024 3. Commit in qemu monitor (qemu) commit drive-system-disk Actual Results: commit will not return error message Verify with qemu-kvm-0.12.1.2-2.400.el6.x86_64 steps as above Actual Results: (qemu) commit drive-system-disk 'commit' error for 'drive-system-disk': Permission denied Based on above information, this issue has been fixed.
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/RHSA-2013-1553.html