Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1534491 - Mirror jobs for drives with iothreads make QEMU to abort with "block.c:1895: bdrv_attach_child: Assertion `bdrv_get_aio_context(parent_bs) == bdrv_get_aio_context(child_bs)' failed."
Mirror jobs for drives with iothreads make QEMU to abort with "block.c:1895: ...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev (Show other bugs)
7.4
Unspecified Unspecified
high Severity high
: rc
: ---
Assigned To: Stefan Hajnoczi
Qianqian Zhu
: ZStream
Depends On:
Blocks: 1535125
  Show dependency treegraph
 
Reported: 2018-01-15 06:17 EST by Sergio Lopez
Modified: 2018-04-10 20:58 EDT (History)
13 users (show)

See Also:
Fixed In Version: QEMU 2.10
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1535125 (view as bug list)
Environment:
Last Closed: 2018-04-10 20:58:52 EDT
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)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 3317791 None None None 2018-01-15 15:33 EST
Red Hat Product Errata RHSA-2018:1104 normal SHIPPED_LIVE Important: qemu-kvm-rhev security, bug fix, and enhancement update 2018-04-10 18:54:38 EDT

  None (edit)
Description Sergio Lopez 2018-01-15 06:17:30 EST
Description of problem:

 * Preparing the images

# qemu-img create -f raw base.img 1g
# qemu-img create -f qcow2 -o backing_file=base.img top1.qcow2
# qemu-img create -f qcow2 -o backing_file=base.img top2.qcow2


 * Running with iothreads

# /usr/libexec/qemu-kvm -m 1g -drive if=none,file=top1.qcow2,format=qcow2,id=drive0 -object iothread,id=iothread0 -device virtio-blk-pci,iothread=iothread0,drive=drive0 -monitor stdio 
QEMU 2.9.0 monitor - type 'help' for more information
(qemu) drive_mirror -n drive0 top2.qcow2
(qemu) info block-jobs
Type mirror, device drive0: Completed 0 of 0 bytes, speed limit 0 bytes/s
(qemu) block_job_complete drive0
qemu-kvm: block.c:1895: bdrv_attach_child: Assertion `bdrv_get_aio_context(parent_bs) == bdrv_get_aio_context(child_bs)' failed.
Aborted (core dumped)


 * Running without iothreads

# /usr/libexec/qemu-kvm -m 1g -drive if=none,file=top1.qcow2,format=qcow2,id=drive0 -device virtio-blk-pci,drive=drive0 -monitor stdio
QEMU 2.9.0 monitor - type 'help' for more information
(qemu) drive_mirror -n drive0 top2.qcow2
(qemu) info block-jobs
Type mirror, device drive0: Completed 0 of 0 bytes, speed limit 0 bytes/s
(qemu) block_job_complete drive0
(qemu) info block-jobs
No active jobs


Version-Release number of selected component (if applicable):

qemu-kvm-rhev-2.9.0-16.el7_4.13.x86_64


How reproducible:

Always


Additional info:

This has been fixed in upstream by this oneliner:

<snip>
[slopezpa@dritchie qemu]$ git show 5ce6bfe255091d532ec4555d0ede816294cb1703
commit 5ce6bfe255091d532ec4555d0ede816294cb1703
Author: sochin.jiang <sochin.jiang@huawei.com>
Date:   Mon Jun 26 19:04:24 2017 +0800

    mirror: Fix inconsistent backing AioContext for after mirroring
    
    mirror_complete opens the backing chain, which should have the same
    AioContext as the top when using iothreads. Make the code guarantee
    this, which fixes a failed assertion in bdrv_attach_child.
    
    Signed-off-by: sochin.jiang <sochin.jiang@huawei.com>
    Message-id: 1498475064-39816-1-git-send-email-sochin.jiang@huawei.com
    [mreitz: Reworded commit message]
    Signed-off-by: Max Reitz <mreitz@redhat.com>

diff --git a/block.c b/block.c
index edfa6b7a2c..b9e5114a27 100644
--- a/block.c
+++ b/block.c
@@ -2185,6 +2185,7 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *parent_options,
         ret = -EINVAL;
         goto free_exit;
     }
+    bdrv_set_aio_context(backing_hd, bdrv_get_aio_context(bs));
 
     /* Hook up the backing file link; drop our reference, bs owns the
      * backing_hd reference now */
</snip>


Please consider backporting this. Thanks.
Comment 4 Qianqian Zhu 2018-01-15 21:54:46 EST
Reproduced on qemu-kvm-rhev-10:2.9.0-14.el7.x86_64 with steps in comment 0.

If mirror source file is base, wont trigger the core dump, the source file must be a snapshot for this issue.

Same steps work well on qemu-kvm-rhev-2.10.0-16.el7.x86_64, so the latest version qemu should have already fixed this issue.
Comment 5 Ademar Reis 2018-01-16 06:35:36 EST
(In reply to Qianqian Zhu from comment #4)
> Reproduced on qemu-kvm-rhev-10:2.9.0-14.el7.x86_64 with steps in comment 0.
> 
> If mirror source file is base, wont trigger the core dump, the source file
> must be a snapshot for this issue.
> 
> Same steps work well on qemu-kvm-rhev-2.10.0-16.el7.x86_64, so the latest
> version qemu should have already fixed this issue.

Indeed, I confirmed the upstream patch pointed in Comment #0 is included in qemu-2.10, changing BZ to MODIFIED.
Comment 8 Qianqian Zhu 2018-01-23 01:23:53 EST
Move to VERIFIED per comment 4.
Comment 10 errata-xmlrpc 2018-04-10 20:58:52 EDT
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-2018:1104

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