RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1130489 - qemu do not close src image immediately after mirroring done
Summary: qemu do not close src image immediately after mirroring done
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev
Version: 7.1
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Jeff Cody
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-08-15 11:53 UTC by Xiaoqing Wei
Modified: 2016-03-28 03:12 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-02-16 00:35:04 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Xiaoqing Wei 2014-08-15 11:53:24 UTC
Description of problem:

qemu do not close src image immediately after mirroring done

Version-Release number of selected component (if applicable):
qemu-img-rhev-2.1.0-1.el7.x86_64
qemu-kvm-common-rhev-2.1.0-1.el7.x86_64
libcacard-devel-rhev-2.1.0-1.el7.x86_64
libcacard-rhev-2.1.0-1.el7.x86_64
qemu-kvm-rhev-2.1.0-1.el7.x86_64
qemu-kvm-tools-rhev-2.1.0-1.el7.x86_64
qemu-kvm-rhev-debuginfo-2.1.0-1.el7.x86_64


How reproducible:
1 / 1

Steps to Reproduce:
0. Prepare two LVMs, 10G *1, 32G *1, and convert a OS img into the 10G(origin img should has 30G virtual size and < 10G actual size)


1.boot a vm
/bin/qemu-kvm -monitor stdio  \
    -S  \
    -name 'virt-tests-vm1'  \
    -sandbox off  \
    -M pc  \
    -nodefaults  \
    -vga std  \
    -chardev socket,id=qmp_id_qmpmonitor1,path=/tmp/monitor-qmpmonitor1-20140815-110559-kPOHZHpD,server,nowait \
    -mon chardev=qmp_id_qmpmonitor1,mode=control  \
    -chardev socket,id=serial_id_serial0,path=/tmp/serial-serial0-20140815-110559-kPOHZHpD,server,nowait \
    -device isa-serial,chardev=serial_id_serial0  \
    -chardev socket,id=seabioslog_id_20140815-110559-kPOHZHpD,path=/tmp/seabios-20140815-110559-kPOHZHpD,server,nowait \
    -device isa-debugcon,chardev=seabioslog_id_20140815-110559-kPOHZHpD,iobase=0x402 \
    -device ich9-usb-uhci1,id=usb1,bus=pci.0,addr=03 \
    -drive id=drive_image1,if=none,cache=none,snapshot=off,aio=native,file='/dev/rhel/lv10g' \
    -device ide-hd,id=image1,drive=drive_image1,bus=ide.0,unit=0 \
    -device virtio-net-pci,mac=9a:a2:a3:a4:a5:a6,id=id4CoZYU,vectors=4,netdev=idd5Ponr,bus=pci.0,addr=04  \
    -netdev tap,id=idd5Ponr,vhost=on  \
    -m 4096  \
    -smp 4,maxcpus=4,cores=2,threads=1,sockets=2  \
    -cpu 'SandyBridge'  \
    -drive id=drive_cd1,if=none,snapshot=off,aio=native,media=cdrom,file=/root/staf-kvm-devel/autotest-devel/client/tests/virt/shared/data/isos/windows/winutils.iso \
    -device ide-cd,id=cd1,drive=drive_cd1,bus=ide.0,unit=1 \
    -device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1  \
    -vnc :0  \
    -rtc base=localtime,clock=host,driftfix=slew  \
    -boot order=cdn,once=c,menu=off \
    -enable-kvm
# info block
drive_image1: /dev/rhel/lv10g (qcow2)
    I/O status:       nospace

drive_cd1: /root/staf-kvm-devel/autotest-devel/client/tests/virt/shared/data/isos/windows/winutils.iso (raw, read-only)
    Removable device: not locked, tray closed

2. mirror the img
{"execute": "drive-mirror", "arguments": {"device": "drive_image1", "mode": "absolute-paths", "format": "qcow2", "target": "/dev/rhel/raw30g", "sync": "full"}, "id": "rUUcP4XX"}
{"return": {}, "id": "rUUcP4XX"}

3. tell qemu to switch the underlying storage
{"execute": "block-job-complete", "arguments": { "device": "drive_image1"} }
{"return": {}}

4. lsof to check both src and target image
[root@localhost ~]# lsof /dev/rhel/lv10g
COMMAND    PID USER   FD   TYPE DEVICE    SIZE/OFF     NODE NAME
qemu-kvm 30966 root   30u   BLK  253,3 0x280000000 29334404 /dev/rhel/../dm-3
[root@localhost ~]# lsof /dev/rhel/raw30g
COMMAND    PID USER   FD   TYPE DEVICE    SIZE/OFF     NODE NAME
qemu-kvm 30966 root   26u   BLK  253,4 0x800000000 29334414 /dev/rhel/../dm-4

5. reboot the VM, and keep filling it's space(till the data > 10G, so that cant held on the src lvm ),
then it closed the src img
[root@localhost ~]# lsof /dev/rhel/lv10g
[root@localhost ~]# lsof /dev/rhel/raw30g
COMMAND    PID USER   FD   TYPE DEVICE    SIZE/OFF     NODE NAME
qemu-kvm 30966 root   26u   BLK  253,4 0x800000000 29334414 /dev/rhel/../dm-4

Actual results:
as 4 shown
Expected results:
step 4 should got same output as 5 shown.

Additional info:

tested on RHEL.6.6, qemu closed the src immediately.

Comment 5 Jeff Cody 2016-02-16 00:35:04 UTC
I've tried reproducing this bug with LVM images, qcow2 standard files, using scsi, virtio, and ide devices.  I've not been able to reproduce this on any qemu-kvm-rhev version (or upstream master).

I wonder if perhaps in the initial report, although a block-job-complete was issued, if the test essentially had a race condition.  Since the command was just issued once in the shell, if it was done prior to receiving the 'BLOCK_JOB_COMPLETED' from QEMU then the source would not yet be closed.

Given that, the lack of reproduction, and that it isn't clear that it is an issue even if we did not close the source fd immediately, I'm closing this as NOTABUG.


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