]> git.proxmox.com Git - mirror_qemu.git/commit - block.c
block: temporarily hold the new AioContext of bs_top in bdrv_append()
authorStefano Garzarella <sgarzare@redhat.com>
Tue, 14 Feb 2023 17:16:21 +0000 (18:16 +0100)
committerKevin Wolf <kwolf@redhat.com>
Fri, 17 Feb 2023 13:33:58 +0000 (14:33 +0100)
commit60d90bf43c169b9d1dbcb17ed794b7b02c6862b1
treecdfc40390163a6187b0eaff1b72d76e9a2b3b8e4
parente7b8d9d038f313c2b9e601609e7d7c3ca6ad0234
block: temporarily hold the new AioContext of bs_top in bdrv_append()

bdrv_append() is called with bs_top AioContext held, but
bdrv_attach_child_noperm() could change the AioContext of bs_top.

bdrv_replace_node_noperm() calls bdrv_drained_begin() starting from
commit 2398747128 ("block: Don't poll in bdrv_replace_child_noperm()").
bdrv_drained_begin() can call BDRV_POLL_WHILE that assumes the new lock
is taken, so let's temporarily hold the new AioContext to prevent QEMU
from failing in BDRV_POLL_WHILE when it tries to release the wrong
AioContext.

Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=2168209
Reported-by: Aihua Liang <aliang@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Message-Id: <20230214171621.11574-1-sgarzare@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block.c