[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 2/7] block: acquire AioContext in qmp_query_block
From: |
Fam Zheng |
Subject: |
[Qemu-devel] [PATCH v2 2/7] block: acquire AioContext in qmp_query_blockstats() |
Date: |
Tue, 17 Jun 2014 14:32:05 +0800 |
From: Stefan Hajnoczi <address@hidden>
Make query-blockstats safe for dataplane by acquiring the
BlockDriverState's AioContext. This ensures that the dataplane IOThread
and the main loop's monitor code do not race.
Note the assumption that acquiring the drive's BDS AioContext also
protects ->file and ->backing_hd. This assumption is made by other
aio_context_acquire() callers too.
Signed-off-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Fam Zheng <address@hidden>
---
block/qapi.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/block/qapi.c b/block/qapi.c
index aeabaaf..f44f6b4 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -360,7 +360,11 @@ BlockStatsList *qmp_query_blockstats(Error **errp)
while ((bs = bdrv_next(bs))) {
BlockStatsList *info = g_malloc0(sizeof(*info));
+ AioContext *ctx = bdrv_get_aio_context(bs);
+
+ aio_context_acquire(ctx);
info->value = bdrv_query_stats(bs);
+ aio_context_release(ctx);
*p_next = info;
p_next = &info->next;
--
2.0.0
- [Qemu-devel] [PATCH v2 0/7] virtio-blk: Unify request handling of dataplane, Fam Zheng, 2014/06/17
- [Qemu-devel] [PATCH v2 1/7] block: make bdrv_query_stats() static, Fam Zheng, 2014/06/17
- [Qemu-devel] [PATCH v2 2/7] block: acquire AioContext in qmp_query_blockstats(),
Fam Zheng <=
- [Qemu-devel] [PATCH v2 3/7] virtio-blk: Make request completion function virtual, Fam Zheng, 2014/06/17
- [Qemu-devel] [PATCH v2 4/7] virtio-blk: Export request handling functions to dataplane, Fam Zheng, 2014/06/17
- [Qemu-devel] [PATCH v2 5/7] virtio-blk: Schedule BH in the right context, Fam Zheng, 2014/06/17
- [Qemu-devel] [PATCH v2 6/7] virtio-blk: Unify {non-, }dataplane's request handlings, Fam Zheng, 2014/06/17
- [Qemu-devel] [PATCH v2 7/7] virtio-blk: Rename complete_request_early to complete_request_vring, Fam Zheng, 2014/06/17
- Re: [Qemu-devel] [PATCH v2 0/7] virtio-blk: Unify request handling of dataplane, Paolo Bonzini, 2014/06/17
- Re: [Qemu-devel] [PATCH v2 0/7] virtio-blk: Unify request handling of dataplane, Stefan Hajnoczi, 2014/06/27