mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
block: Honor blk_set_aio_context() context requirements
The documentation for bdrv_set_aio_context_ignore() states this: * The caller must own the AioContext lock for the old AioContext of bs, but it * must not own the AioContext lock for new_context (unless new_context is the * same as the current context of bs). As blk_set_aio_context() makes use of this function, this rule also applies to it. Fix all occurrences where this rule wasn't honored. Suggested-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Sergio Lopez <slp@redhat.com> Message-Id: <20201214170519.223781-2-slp@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
af74b550bd
commit
c7040ff64e
3 changed files with 14 additions and 3 deletions
|
@ -725,6 +725,7 @@ void xen_block_dataplane_start(XenBlockDataPlane *dataplane,
|
|||
{
|
||||
ERRP_GUARD();
|
||||
XenDevice *xendev = dataplane->xendev;
|
||||
AioContext *old_context;
|
||||
unsigned int ring_size;
|
||||
unsigned int i;
|
||||
|
||||
|
@ -808,10 +809,14 @@ void xen_block_dataplane_start(XenBlockDataPlane *dataplane,
|
|||
goto stop;
|
||||
}
|
||||
|
||||
aio_context_acquire(dataplane->ctx);
|
||||
old_context = blk_get_aio_context(dataplane->blk);
|
||||
aio_context_acquire(old_context);
|
||||
/* If other users keep the BlockBackend in the iothread, that's ok */
|
||||
blk_set_aio_context(dataplane->blk, dataplane->ctx, NULL);
|
||||
aio_context_release(old_context);
|
||||
|
||||
/* Only reason for failure is a NULL channel */
|
||||
aio_context_acquire(dataplane->ctx);
|
||||
xen_device_set_event_channel_context(xendev, dataplane->event_channel,
|
||||
dataplane->ctx, &error_abort);
|
||||
aio_context_release(dataplane->ctx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue