Bug 1492178

Summary: Non-top-level change-backing-file causes assertion failure
Product: Red Hat Enterprise Linux 7 Reporter: Kevin Wolf <kwolf>
Component: qemu-kvm-rhevAssignee: Kevin Wolf <kwolf>
Status: CLOSED ERRATA QA Contact: Qianqian Zhu <qizhu>
Severity: high Docs Contact:
Priority: high    
Version: 7.5CC: chayang, coli, jinzhao, juzhang, kwolf, lmiksik, michen, mrezanin, ngu, qizhu, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-rhev-2.10.0-11.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-11 00:36:03 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 Kevin Wolf 2017-09-15 16:20:31 UTC
The following was tested on upstream qemu.git master. 2.10 is affected.

Steps to reproduce the assertion failure:

1. Create a backing file chain with at least three images:

$ qemu-img create -f qcow2 /tmp/base.qcow2 64M
$ qemu-img create -f qcow2 -b /tmp/base.qcow2 /tmp/mid.qcow2
$ qemu-img create -f qcow2 -b /tmp/mid.qcow2 /tmp/top.qcow2

2. Try to use the "change-backing-file" QMP command to change the backing file of mid.qcow2:

$ LANG=C x86_64-softmmu/qemu-system-x86_64 -drive file=/tmp/top.qcow2,backing.node-name=mid -qmp stdio
{"QMP": {"version": {"qemu": {"micro": 50, "minor": 10, "major": 2}, "package": " (v2.10.0-485-g6beb456cac)"}, "capabilities": []}}
{"execute":"qmp_capabilities"}
{"return": {}}
{"execute":"change-backing-file", "arguments":{"device":"ide0-hd0","image-node-name":"mid","backing-file":"/dev/null"}}
qemu-system-x86_64: block/io.c:1359: bdrv_aligned_pwritev: Assertion `child->perm & BLK_PERM_WRITE' failed.

This will be fixed upstream with the following series:

    [PATCH 0/6] block: Fix permissions after ro/rw reopen
    https://lists.gnu.org/archive/html/qemu-block/2017-09/msg00449.html

Comment 3 Miroslav Rezanina 2017-12-05 12:58:37 UTC
Fix included in qemu-kvm-rhev-2.10.0-11.el7

Comment 5 Qianqian Zhu 2017-12-06 08:15:40 UTC
Reproduced on qemu-kvm-rhev-10:2.10.0-9.el7:

Steps:
[root@dhcp-8-119 pkgs]# qemu-img create -f qcow2 /tmp/base.qcow2 64M
[root@dhcp-8-119 pkgs]#  qemu-img create -f qcow2 -b /tmp/base.qcow2 /tmp/mid.qcow2
[root@dhcp-8-119 pkgs]# qemu-img create -f qcow2 -b /tmp/mid.qcow2 /tmp/top.qcow2

[root@dhcp-8-119 pkgs]# /usr/libexec/qemu-kvm -drive file=/tmp/top.qcow2,backing.node-name=mid -qmp stdio
{"QMP": {"version": {"qemu": {"micro": 0, "minor": 10, "major": 2}, "package": "(qemu-kvm-rhev-2.10.0-9.el7)"}, "capabilities": []}}
VNC server running on ::1:5900
{"execute":"qmp_capabilities"}
{"return": {}}
{"execute":"change-backing-file", "arguments":{"device":"ide0-hd0","image-node-name":"mid","backing-file":"/dev/null"}}

Result:
qemu-kvm: block/io.c:1359: bdrv_aligned_pwritev: Assertion `child->perm & BLK_PERM_WRITE' failed.
Aborted (core dumped)

Verified on qemu-kvm-rhev-10:2.10.0-11.el7:
Steps:
Same as above.

Result:
Change backing file success.
{"execute":"query-block"}
 "backing-filename": "/dev/null"

Moving to VERIFIED based on above result.

Comment 7 errata-xmlrpc 2018-04-11 00:36:03 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