]> git.ipfire.org Git - thirdparty/qemu.git/commit
block-backend: Fix blk_new_open() for iothreads
authorKevin Wolf <kwolf@redhat.com>
Thu, 25 May 2023 12:47:05 +0000 (14:47 +0200)
committerKevin Wolf <kwolf@redhat.com>
Tue, 30 May 2023 15:21:23 +0000 (17:21 +0200)
commit4c20dd24b1178c78c47bf323173360b85e65e1e1
tree625f8938dd6f5004d54c4f609f178dd239fa8590
parentc6e0a6de62c5fa99ef06a9bb49c8072bcf93f431
block-backend: Fix blk_new_open() for iothreads

This fixes blk_new_open() to not assume that bs is in the main context.

In particular, the BlockBackend must be created with the right
AioContext because it will refuse to move to a different context
afterwards. (blk->allow_aio_context_change is false.)

Use this opportunity to use blk_insert_bs() instead of duplicating the
bdrv_root_attach_child() call. This is consistent with what
blk_new_with_bs() does. Add comments to document the locking rules.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20230525124713.401149-5-kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/block-backend.c