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 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."
Summary: Mirror jobs for drives with iothreads make QEMU to abort with "block.c:1895: ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev
Version: 7.4
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: ---
Assignee: Stefan Hajnoczi
QA Contact: Qianqian Zhu
URL:
Whiteboard:
Depends On:
Blocks: 1535125
TreeView+ depends on / blocked
 
Reported: 2018-01-15 11:17 UTC by Sergio Lopez
Modified: 2021-06-10 14:11 UTC (History)
13 users (show)

Fixed In Version: QEMU 2.10
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1535125 (view as bug list)
Environment:
Last Closed: 2018-04-11 00:58:52 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 3317791 0 None None None 2018-01-15 20:33:58 UTC
Red Hat Product Errata RHSA-2018:1104 0 normal SHIPPED_LIVE Important: qemu-kvm-rhev security, bug fix, and enhancement update 2018-04-10 22:54:38 UTC

Description Sergio Lopez 2018-01-15 11:17:30 UTC
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>
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>
    Message-id: 1498475064-39816-1-git-send-email-sochin.jiang
    [mreitz: Reworded commit message]
    Signed-off-by: Max Reitz <mreitz>

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-16 02:54:46 UTC
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 11:35:36 UTC
(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 06:23:53 UTC
Move to VERIFIED per comment 4.

Comment 10 errata-xmlrpc 2018-04-11 00:58:52 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-2018:1104


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