Bug 1452048

Summary: qemu abort when hot unplug block device during live commit
Product: Red Hat Enterprise Linux 7 Reporter: Qianqian Zhu <qizhu>
Component: qemu-kvm-rhevAssignee: Kevin Wolf <kwolf>
Status: CLOSED ERRATA QA Contact: Qianqian Zhu <qizhu>
Severity: high Docs Contact:
Priority: urgent    
Version: 7.4CC: chayang, hreitz, jcody, juzhang, knoel, lmiksik, michen, virt-bugs, virt-maint, xfu
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: qemu-kvm-rhev-2.9.0-10.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-02 04:41:00 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:

Description Qianqian Zhu 2017-05-18 08:42:52 UTC
Description of problem:
qemu abort when hot unplug block device during live commit.

Version-Release number of selected component (if applicable):
kernel-3.10.0-640.el7.x86_64
qemu-kvm-rhev-2.9.0-5.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Launch guest
(gdb) run -name 'avocado-vt-vm1' \
    -vga cirrus \
    -device virtio-scsi-pci,id=virtio_scsi_pci0,bus=pci.0,addr=03 \
    -drive id=drive_image1,if=none,snapshot=off,aio=native,cache=none,format=raw,file=/home/kvm_autotest_root/images/rhel74-64-virtio-scsi.raw \
    -device scsi-hd,id=image1,drive=drive_image1 \
    -device virtio-net-pci,mac=9a:ac:ad:ae:af:b0,id=idqKTtyC,vectors=4,netdev=idBAxKKY,bus=pci.0,addr=04 \
    -netdev tap,id=idBAxKKY,vhost=on \
    -m 4096 \
    -smp 4,cores=2,threads=1,sockets=2 \
    -cpu 'SandyBridge',+kvm_pv_unhalt \
    -vnc :0 \
    -rtc base=utc,clock=host,driftfix=slew \
    -boot order=cdn,once=c,menu=off,strict=off \
    -monitor stdio \
    -qmp tcp::5555,server,nowait

2. Live snapshot:
{ "execute": "blockdev-snapshot-sync", "arguments": { "device": "drive_image1","snapshot-file": "/mnt/iscsi/sn1", "format": "qcow2", "mode": "absolute-paths" } }
{"return": {}}
{ "execute": "blockdev-snapshot-sync", "arguments": { "device": "drive_image1","snapshot-file": "/mnt/iscsi/sn2", "format": "qcow2", "mode": "absolute-paths" } }
{"return": {}}
{ "execute": "blockdev-snapshot-sync", "arguments": { "device": "drive_image1","snapshot-file": "/mnt/iscsi/sn3", "format": "qcow2", "mode": "absolute-paths" } }

dd a 1G file on sn3.

{ "execute": "blockdev-snapshot-sync", "arguments": { "device": "drive_image1","snapshot-file": "/mnt/iscsi/sn4", "format": "qcow2", "mode": "absolute-paths" } }

3. Live commit from sn3 to sn1:
{ "execute": "block-commit", "arguments": { "device": "drive_image1", "base": "/mnt/iscsi/sn1", "top": "/mnt/iscsi/sn3"}}

4. Hot unplug the block device:
{ "execute": "device_del", "arguments": { "id": "image1"}}


Actual results:
qemu abort:
main-loop: WARNING: I/O thread spun for 1000 iterations
[New Thread 0x7ffedf9ff700 (LWP 26964)]
qemu-kvm: block.c:1894: bdrv_attach_child: Assertion `parent_bs->drv' failed.

Program received signal SIGABRT, Aborted.
0x00007fffed4b81f7 in raise () from /lib64/libc.so.6


Expected results:
Hot unplug succeeds, block job being cancelled.

Additional info:
qemu-kvm-rhev-2.6.0-27.el7.x86_64 has no this issue, so this is a regression.

Comment 3 Ademar Reis 2017-05-22 17:04:29 UTC
Looks like an assertion added by the new op-blockers:

commit f68c598be6a48995ca4c7cc42fc1f6e1195ec7aa
Author: Kevin Wolf <kwolf>
Date:   Tue Dec 20 15:51:12 2016 +0100

    block: Request real permissions in bdrv_attach_child()
    
    Now that all block drivers with children tell us what permissions they
    need from each of their children, bdrv_attach_child() can use this
    information and make the right requirements while trying to attach new
    children.
    
    Signed-off-by: Kevin Wolf <kwolf>
    Acked-by: Fam Zheng <famz>
    Reviewed-by: Max Reitz <mreitz>

Comment 4 Kevin Wolf 2017-06-12 13:35:46 UTC
I fixed this in upstream commit 19ebd13e. Posted a backport now.

Comment 6 Miroslav Rezanina 2017-06-13 16:35:11 UTC
Fix included in qemu-kvm-rhev-2.9.0-10.el7

Comment 7 Qianqian Zhu 2017-06-14 05:35:03 UTC
Verified with:
qemu-kvm-rhev-2.9.0-10.el7.x86_64
kernel-3.10.0-679.el7.x86_64

Steps:
Same as comment 0.
Results:
As expected, Hot unplug succeeds, block job is cancelled.

Comment 10 Qianqian Zhu 2017-06-16 06:18:32 UTC
Moving to VERIFIED per comment 7 and comment 9.

Comment 12 errata-xmlrpc 2017-08-02 04:41:00 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.

https://access.redhat.com/errata/RHSA-2017:2392