[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Assertion failure taking external snapshot with virtio
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] Assertion failure taking external snapshot with virtio drive + iothread |
Date: |
Fri, 17 Mar 2017 20:27:51 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 |
On 17/03/2017 18:32, Ed Swierk wrote:
> On Fri, Mar 17, 2017 at 10:15 AM, Paolo Bonzini <address@hidden> wrote:
>>
>>
>> On 17/03/2017 18:11, Paolo Bonzini wrote:
>>>
>>>
>>> On 17/03/2017 17:55, Ed Swierk wrote:
>>>> I'm running into the same problem taking an external snapshot with a
>>>> virtio-blk drive with iothread, so it's not specific to virtio-scsi.
>>>> Run a Linux guest on qemu master
>>>>
>>>> qemu-system-x86_64 -nographic -enable-kvm -monitor
>>>> telnet:0.0.0.0:1234,server,nowait -m 1024 -object
>>>> iothread,id=iothread1 -drive file=/x/drive.qcow2,if=none,id=drive0
>>>> -device virtio-blk-pci,iothread=iothread1,drive=drive0
>>>>
>>>> Then in the monitor
>>>>
>>>> snapshot_blkdev drive0 /x/snap1.qcow2
>>>>
>>>> qemu bombs with
>>>>
>>>> qemu-system-x86_64: /x/qemu/include/block/aio.h:457:
>>>> aio_enable_external: Assertion `ctx->external_disable_cnt > 0' failed.
>>>>
>>>> whereas without the iothread the assertion failure does not occur.
>>>
>>> Please try this patch:
>>
>> Hmm, no. I'll post the full fix on top of John Snow's patches.
>
> OK. Incidentally, testing with virtio-blk I bisected the assertion
> failure to b2c2832c6140cfe3ddc0de2d77eeb0b77dea8fd3 ("block: Add Error
> parameter to bdrv_append()").
And this is a fix, but I have no idea why/how it works and what else it
may break.
Patches 1 and 2 are pretty obvious and would be the first step towards
eliminating aio_disable/enable_external altogether.
However I got patch 3 more or less by trial and error, and when I
thought I had the reasoning right I noticed this:
bdrv_drained_end(state->old_bs);
in external_snapshot_clean which makes no sense given the
bdrv_drained_begin(bs_new);
that I added to bdrv_append. So take this with a ton of salt.
The basic idea is that calling child->role->drained_begin and
child->role->drained_end is not necessary and in fact actively wrong
when both the old and the new child should be in a drained section.
But maybe instead it should be asserted that they are, except for the
special case of adding or removing a child. i.e. after
int drain = !!(old_bs && old_bs->quiesce_counter) - !!(new_bs &&
new_bs->quiesce_counter);
add
assert(!(drain && old_bs && new_bs));
Throwing this out because it's Friday evening... Maybe Fam can pick
it up on Monday.
Paolo
ff.patch
Description: Text Data
Re: [Qemu-devel] Assertion failure taking external snapshot with virtio drive + iothread, Fam Zheng, 2017/03/21