Bug 641127

Summary: qemu-img ignores close() errors
Product: Red Hat Enterprise Linux 6 Reporter: Eduardo Habkost <ehabkost>
Component: qemu-kvmAssignee: Eduardo Habkost <ehabkost>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 6.0CC: llim, mkenneth, snagar, szhou, tburke, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: qemu-kvm-0.12.1.2-2.116.el6 Doc Type: Bug Fix
Doc Text:
Cause: qemu-img ignored close() errors when running 'qemu-img create' Consequence: on some scenarios (e.g. when using a NF filesystem), errors where ignored when creating an image using 'qemu-img create'. Fix: qemu-img create now checks for close() errors. Result: more reliable error handling of 'qemu-img create'.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 11:32:36 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: 580954    

Description Eduardo Habkost 2010-10-07 19:31:43 UTC
Description of problem:

On a machine having NFS trouble, 'qemu-img create' tries to create a new qcow2 image and when close() returns -EIO, but the error is silently ignored.


Version-Release number of selected component (if applicable):
qemu-img-0.12.1.2-2.113.el6.x86_64

How reproducible:
Not easily, as you have to make close() return error (I have a machine where this is happening for unknown reasons).


Steps to Reproduce:
1) break NFS  :)
2) run: qemu-img create -f qcow2 /path/to/file/on/nfs.qcow2 10G

  
Actual results:
# strace -f qemu-img create -f qcow2 /tmp/kvm_autotest_root/images/rhel5-32.qcow2 10G
execve("/usr/bin/qemu-img", ["qemu-img", "create", "-f", "qcow2", "/tmp/kvm_autotest_root/images/rh"..., "10G"], [/* 29 vars */]) = 0
brk(0)                                  = 0x2226000
[...]
write(1, "Formatting '/tmp/kvm_autotest_ro"..., 117Formatting '/tmp/kvm_autotest_root/images/rhel5-32.qcow2', fmt=qcow2 size=10737418240 encryption=off cluster_size=0
) = 117
open("/tmp/kvm_autotest_root/images/rhel5-32.qcow2", O_WRONLY|O_CREAT|O_TRUNC, 0644) = 3
write(3, "QFI\373\0\0\0\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\20\0\0\0\2\200\0\0\0"..., 72) = 72
lseek(3, 65536, SEEK_SET)               = 65536
write(3, "\0\0\0\0\0\0\0\0", 8)         = 8
[...]
close(3)                                = -1 EIO (Input/output error)
exit_group(0)                           = ?
[root@virtlab105 default]# date
Thu Oct  7 15:30:46 EDT 2010
[root@virtlab105 default]# ls -l /tmp/kvm_autotest_root/images/rhel5-32.qcow2
-rw-r--r-- 1 root root 262144 Oct  7 15:27 /tmp/kvm_autotest_root/images/rhel5-32.qcow2
[root@virtlab105 default]# date
Thu Oct  7 15:30:52 EDT 2010
[root@virtlab105 default]# ls -l /tmp/kvm_autotest_root/images/rhel5-32.qcow2
-rw-r--r-- 1 root root 0 Oct  7 15:27 /tmp/kvm_autotest_root/images/rhel5-32.qcow2
[root@virtlab105 default]# 


Expected results:
qemu-img should return non-zero exit code and show an error message.

Comment 5 Shirley Zhou 2011-01-13 05:21:17 UTC
Cannot reproduce this bug with qemu-kvm-0.12.1.2-2.129.el6, and confirm the patch: 

# grep "check for close() errors on qcow2_create()" *
kvm-check-for-close-errors-on-qcow2_create.patch:Subject: [RHEL6 qemu-kvm PATCH 3/3] check for close() errors on qcow2_create()
kvm-check-for-close-errors-on-qcow2_create.patch:O-Subject: [RHEL6 qemu-kvm PATCH] check for close() errors on qcow2_create()

# grep "kvm-check-for-close-errors-on-qcow2_create.patch" ../SPECS/*
Patch1714: kvm-check-for-close-errors-on-qcow2_create.patch
- kvm-check-for-close-errors-on-qcow2_create.patch [bz#641127]

# grep  -i Patch1714 ../SPECS/*
Patch1714: kvm-check-for-close-errors-on-qcow2_create.patch
%patch1714 -p1

So this bug has been resolved.

Comment 7 Eduardo Habkost 2011-05-05 17:37:30 UTC
    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: qemu-img ignored close() errors when running 'qemu-img create'

Consequence: on some scenarios (e.g. when using a NF filesystem), errors where ignored when creating an image using 'qemu-img create'.

Fix: qemu-img create now checks for close() errors.

Result: more reliable error handling of 'qemu-img create'.

Comment 8 errata-xmlrpc 2011-05-19 11:32:36 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-0534.html

Comment 9 errata-xmlrpc 2011-05-19 12:49:27 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-0534.html