diff options
author | Kevin Wolf <kwolf@redhat.com> | 2023-05-25 14:47:08 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2023-05-30 17:21:23 +0200 |
commit | 6e0121593288252d9e62448578368678eea3446c (patch) | |
tree | c94fae516b929aec3c063b77b3d7b4bc3241e0a6 /block | |
parent | aa269ff888d70158fe0c26ed17814046bdc19bd5 (diff) |
raw-format: Fix open with 'file' in iothread
When opening the 'file' child moves bs to an iothread, we need to hold
the AioContext lock of it before we can call raw_apply_options() (and
more specifically, bdrv_getlength() inside of it).
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20230525124713.401149-8-kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/raw-format.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/block/raw-format.c b/block/raw-format.c index 918fe4fb7e..e4f35268e6 100644 --- a/block/raw-format.c +++ b/block/raw-format.c @@ -468,6 +468,7 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVRawState *s = bs->opaque; + AioContext *ctx; bool has_size; uint64_t offset, size; BdrvChildRole file_role; @@ -515,7 +516,11 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags, bs->file->bs->filename); } + ctx = bdrv_get_aio_context(bs); + aio_context_acquire(ctx); ret = raw_apply_options(bs, s, offset, has_size, size, errp); + aio_context_release(ctx); + if (ret < 0) { return ret; } |