Bug 856505

Summary: Missing error message in bdrv_commit to read-only backing file
Product: Red Hat Enterprise Linux 6 Reporter: Joy Pu <ypu>
Component: qemu-kvmAssignee: Jeff Cody <jcody>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.4CC: acathrow, areis, bsarathy, jcody, juzhang, kwolf, lnovich, mkenneth, qzhang, rhod, sluo, virt-maint, zhzhang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-0.12.1.2-2.397.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 856598 894250 894251 894253 (view as bug list) Environment:
Last Closed: 2013-11-21 05:52:20 UTC Type: Bug
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: 856598    

Description Joy Pu 2012-09-12 07:46:56 UTC
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:

Comment 3 Sibiao Luo 2013-01-11 08:05:03 UTC
I tried the rhel7 aslo hit this issue, clone it to rhel7 for fixing, please correct me if any error.

Comment 4 Jeff Cody 2013-01-15 22:30:54 UTC
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.

Comment 5 Jeff Cody 2013-01-18 19:39:26 UTC
Patch submitted upstream:
https://lists.gnu.org/archive/html/qemu-devel/2013-01/msg03456.html

Comment 16 zhonglinzhang 2013-09-09 08:54:29 UTC
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.

Comment 19 errata-xmlrpc 2013-11-21 05:52:20 UTC
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