diff options
| author | Stefan Hajnoczi | 2015-11-04 18:27:23 +0100 |
|---|---|---|
| committer | Stefan Hajnoczi | 2015-11-09 11:07:10 +0100 |
| commit | 84aa0140dd4f04f5d993f0db14c40da8d3de2706 (patch) | |
| tree | 2e7a4d24c00263d64daf8d6b94f617198d0fe649 /blockdev.c | |
| parent | monitor: add missed aio_context_acquire into vm_completion call (diff) | |
| download | qemu-84aa0140dd4f04f5d993f0db14c40da8d3de2706.tar.gz qemu-84aa0140dd4f04f5d993f0db14c40da8d3de2706.tar.xz qemu-84aa0140dd4f04f5d993f0db14c40da8d3de2706.zip | |
blockdev: acquire AioContext in hmp_commit()
This one slipped through. Although we acquire AioContext when
committing all devices we don't for just a single device.
AioContext must be acquired before calling bdrv_*() functions to
synchronize access with other threads that may be using the AioContext.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'blockdev.c')
| -rw-r--r-- | blockdev.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/blockdev.c b/blockdev.c index 8b8bfa992c..97be42f6cd 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1120,6 +1120,9 @@ void hmp_commit(Monitor *mon, const QDict *qdict) if (!strcmp(device, "all")) { ret = bdrv_commit_all(); } else { + BlockDriverState *bs; + AioContext *aio_context; + blk = blk_by_name(device); if (!blk) { monitor_printf(mon, "Device '%s' not found\n", device); @@ -1129,7 +1132,14 @@ void hmp_commit(Monitor *mon, const QDict *qdict) monitor_printf(mon, "Device '%s' has no medium\n", device); return; } - ret = bdrv_commit(blk_bs(blk)); + + bs = blk_bs(blk); + aio_context = bdrv_get_aio_context(bs); + aio_context_acquire(aio_context); + + ret = bdrv_commit(bs); + + aio_context_release(aio_context); } if (ret < 0) { monitor_printf(mon, "'commit' error for '%s': %s\n", device, |
