[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 04/10] blockdev: acquire AioContext in hmp_commit()
From: |
Denis V. Lunev |
Subject: |
[Qemu-stable] [PATCH 04/10] blockdev: acquire AioContext in hmp_commit() |
Date: |
Tue, 3 Nov 2015 17:12:07 +0300 |
From: Stefan Hajnoczi <address@hidden>
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 <address@hidden>
Signed-off-by: Denis V. Lunev <address@hidden>
---
blockdev.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/blockdev.c b/blockdev.c
index 18712d2..d611779 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,
--
2.5.0
- [Qemu-stable] [PATCH QEMU 2.5 v4 0/10] dataplane snapshot fixes + aio_poll fixes, Denis V. Lunev, 2015/11/03
- [Qemu-stable] [PATCH 01/10] migration: add missed aio_context_acquire for state writing/reading, Denis V. Lunev, 2015/11/03
- [Qemu-stable] [PATCH 02/10] block: add missed aio_context_acquire around bdrv_set_aio_context, Denis V. Lunev, 2015/11/03
- [Qemu-stable] [PATCH 03/10] migration: added missed aio_context_acquire around bdrv_snapshot_delete, Denis V. Lunev, 2015/11/03
- [Qemu-stable] [PATCH 05/10] block: guard bdrv_drain in bdrv_close with aio_context_acquire, Denis V. Lunev, 2015/11/03
- [Qemu-stable] [PATCH 04/10] blockdev: acquire AioContext in hmp_commit(),
Denis V. Lunev <=
- [Qemu-stable] [PATCH 07/10] block: call aio_context_acquire in qemu_img/nbd/io, Denis V. Lunev, 2015/11/03
- [Qemu-stable] [PATCH 08/10] fifolock: create rfifolock_is_owner helper, Denis V. Lunev, 2015/11/03
- [Qemu-stable] [PATCH 06/10] io: guard aio_poll with aio_context_acquire, Denis V. Lunev, 2015/11/03
- [Qemu-stable] [PATCH 09/10] aio_context: create aio_context_is_owner helper, Denis V. Lunev, 2015/11/03
- [Qemu-stable] [PATCH 10/10] aio: change aio_poll constraints, Denis V. Lunev, 2015/11/03