Bug 1259229 - drive-mirror blocks QEMU due to lseek64() on raw image files
drive-mirror blocks QEMU due to lseek64() on raw image files
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev (Show other bugs)
7.2
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Fam Zheng
Virtualization Bugs
:
: 1249883 1263046 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-09-02 05:08 EDT by Stefan Hajnoczi
Modified: 2015-12-04 11:55 EST (History)
9 users (show)

See Also:
Fixed In Version: qemu-kvm-rhev-2.3.0-23.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-12-04 11:55:11 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Stefan Hajnoczi 2015-09-02 05:08:00 EDT
Description of problem:

I thought Fam had backported fixes to qemu-kvm-rhev 7.2 but I just hit the following problem with qemu-kvm-rhev-2.3.0-21.el7.

The drive-mirror block job checks which sectors are allocated in the source image before starting copy iterations.  Unfortunately the allocation checking is performed in blocking fashion so QEMU and the monitor hang until the entire image has been checked.

How reproducible:
100%

Steps to Reproduce:
Prerequisites: raw image file on ext4

1. x86_64-softmmu/qemu-system-x86_64 -enable-kvm -drive if=none,id=drive0,file=test.img,format=raw,cache=none
2. (qemu) drive_mirror drive0 /var/tmp/foo.img 

Actual results:

QEMU is blocked and the monitor hangs

Expected results:

QEMU should be responsive and the monitor should work while the drive-mirror block job is running.
Comment 4 Fam Zheng 2015-09-07 05:17:44 EDT
*** Bug 1249883 has been marked as a duplicate of this bug. ***
Comment 5 Miroslav Rezanina 2015-09-15 06:50:54 EDT
Fix included in qemu-kvm-rhev-2.3.0-23.el7
Comment 6 Pei Zhang 2015-09-15 23:01:38 EDT
Summary: When I tested with qemu-kvm-rhev-2.3.0-21.el7.x86_64, the qemu is responsive, qmp monitor works well, just guest hang. Then I also tried lower version, qemu-kvm-rhev-2.3.0-12.el7.x86_64, and this bug is reproduced.
I verified this bug with qemu-kvm-rhev-2.3.0-23.el7, the results below can prove that this bug has been fixed well.


Reproduced:
1 guest hang, qemu works well
Host:
Kernel:3.10.0-315.el7.x86_64
qemu-kvm-rhev:qemu-kvm-rhev-2.3.0-21.el7.x86_64

Steps:
1.1 boot guest
/usr/libexec/qemu-kvm -name rhel6.7z -machine pc-i440fx-rhel7.2.0,accel=kvm \
-cpu SandyBridge -m 4G,slots=256,maxmem=40G -numa node \
-smp 4,sockets=2,cores=2,threads=1 \
-uuid 82b1a01e-5f6c-4f5f-8d27-3855a74e6b61 \
-netdev tap,id=hostnet0 \
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=12:54:00:5c:88:61 \
-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vgamem_mb=16 \
-vnc 0.0.0.0:1 \
-monitor stdio \
-qmp tcp:0:5555,server,nowait \
-serial unix:/tmp/monitor,server,nowait \
-drive file=/mnt/disk4/rhel6.7_virtio.raw,format=raw,if=none,id=drive-virtio-blk0,werror=stop,rerror=stop \
-device virtio-blk-pci,drive=drive-virtio-blk0,id=virtio-blk0 \

1.2 do drive-mirror, guest hang.
QEMU 2.3.0 monitor - type 'help' for more information
(qemu) drive_mirror drive-virtio-blk0 /mnt/disk4/mirror.raw
Formatting '/mnt/disk4/mirror.raw', fmt=raw size=21474836480
(qemu) 
(qemu) 
(qemu) 
(qemu) 
(qemu) info status
VM status: running
(qemu) 
(qemu) 
(qemu) 
(qemu) info status
VM status: running
(qemu)

1.3 query mirror job, no data is written to the target image.
{ "execute" : "query-block-jobs", "arguments" : {} }
{"return": []}
{ "execute" : "query-block-jobs", "arguments" : {} }
{"return": [{"io-status": "ok", "device": "drive-virtio-blk0", "busy": false, "len": 0, "offset": 0, "paused": false, "speed": 0, "ready": false, "type": "mirror"}]}
{ "execute" : "query-block-jobs", "arguments" : {} }
{"return": [{"io-status": "ok", "device": "drive-virtio-blk0", "busy": false, "len": 0, "offset": 0, "paused": false, "speed": 0, "ready": false, "type": "mirror"}]}


2 guest hang, qemu hang
Host:
Kernel:3.10.0-315.el7.x86_64
qemu-kvm-rhev:qemu-kvm-rhev-2.3.0-12.el7.x86_64

Steps:
2.1 boot guest
Same command with step 1.1 

2.2 do drive-mirror, qemu hang. And guest hang.
(qemu) drive_mirror drive-virtio-blk0 /mnt/disk4/mirror.raw
Formatting '/mnt/disk4/mirror.raw', fmt=raw size=21474836480

2.3 query mirror job, qmp not return, qmp monitor hang.
{ "execute" : "query-block-jobs", "arguments" : {} }



Verified:
Host:
Kernel:3.10.0-315.el7.x86_64
qemu-kvm-rhev:qemu-kvm-rhev-2.3.0-23.el7.x86_64

Prerequisites: 
raw image file on ext4.

Steps:
1. boot guest
# /usr/libexec/qemu-kvm -name rhel6.7z -machine pc-i440fx-rhel7.2.0,accel=kvm \
-cpu SandyBridge -m 4G,slots=256,maxmem=40G -numa node \
-smp 4,sockets=2,cores=2,threads=1 \
-uuid 82b1a01e-5f6c-4f5f-8d27-3855a74e6b61 \
-netdev tap,id=hostnet0 \
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=12:54:00:5c:88:61 \
-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vgamem_mb=16 \
-vnc 0.0.0.0:1 \
-monitor stdio \
-qmp tcp:0:5555,server,nowait \
-serial unix:/tmp/monitor,server,nowait \
-drive file=/mnt/disk4/rhel6.7_virtio.raw,format=raw,if=none,id=drive-virtio-blk0,werror=stop,rerror=stop \
-device virtio-blk-pci,drive=drive-virtio-blk0,id=virtio-blk0 \

2. drive-mirror
(1) drive-mirror in qemu monitor, and query mirror job
(qemu) drive_mirror drive-virtio-blk0 /mnt/disk4/mirror.raw
Formatting '/mnt/disk4/mirror.raw', fmt=raw size=21474836480

{ "execute" : "query-block-jobs", "arguments" : {} }
{"return": [{"io-status": "ok", "device": "drive-virtio-blk0", "busy": true, "len": 21474967552, "offset": 11681136640, "paused": false, "speed": 0, "ready": false, "type": "mirror"}]}

{"timestamp": {"seconds": 1442368656, "microseconds": 681306}, "event": "BLOCK_JOB_READY", "data": {"device": "drive-virtio-blk0", "len": 21475360768, "offset": 21475360768, "speed": 0, "type": "mirror"}}

(2)reopen 
{"execute": "block-job-complete", "arguments": { "device": "drive-virtio-blk0"} }
{"return": {}}
{"timestamp": {"seconds": 1442368751, "microseconds": 886669}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "drive-virtio-blk0", "len": 21477588992, "offset": 21477588992, "speed": 0, "type": "mirror"}}

(qemu) info block
drive-virtio-blk0: /mnt/disk4/mirror.raw (raw)
    Cache mode:       writeback
...

3. qemu and guest both work well. After reboot guest sever times, they still work well.


I also tried xfs, it works well. So this bug is fixed.
Comment 7 Fam Zheng 2015-09-17 02:46:50 EDT
*** Bug 1263046 has been marked as a duplicate of this bug. ***
Comment 8 juzhang 2015-09-17 21:25:32 EDT
According to comment6, set this issue as verified.
Comment 10 errata-xmlrpc 2015-12-04 11:55:11 EST
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.

https://rhn.redhat.com/errata/RHBA-2015-2546.html

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