* [Qemu-devel] [PATCH 0/2] block: support block_resize with dataplane
@ 2014-08-18 13:52 Stefan Hajnoczi
2014-08-18 13:52 ` [Qemu-devel] [PATCH 1/2] block: acquire AioContext in qmp_block_resize() Stefan Hajnoczi
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2014-08-18 13:52 UTC (permalink / raw)
To: qemu-devel; +Cc: Kevin Wolf, Andrey Korolyov, Stefan Hajnoczi, Max Reitz
We have the op blocker and AioContext acquire/release infrastructure to safely
allow block monitor commands on dataplane commands. It is now easy to make
block_resize safe.
Stefan Hajnoczi (2):
block: acquire AioContext in qmp_block_resize()
virtio-blk: allow block_resize with dataplane
blockdev.c | 13 ++++++++++---
hw/block/dataplane/virtio-blk.c | 1 +
2 files changed, 11 insertions(+), 3 deletions(-)
--
1.9.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 1/2] block: acquire AioContext in qmp_block_resize()
2014-08-18 13:52 [Qemu-devel] [PATCH 0/2] block: support block_resize with dataplane Stefan Hajnoczi
@ 2014-08-18 13:52 ` Stefan Hajnoczi
2014-08-18 15:54 ` Max Reitz
2014-08-18 13:52 ` [Qemu-devel] [PATCH 2/2] virtio-blk: allow block_resize with dataplane Stefan Hajnoczi
2014-08-20 9:54 ` [Qemu-devel] [PATCH 0/2] block: support " Kevin Wolf
2 siblings, 1 reply; 6+ messages in thread
From: Stefan Hajnoczi @ 2014-08-18 13:52 UTC (permalink / raw)
To: qemu-devel; +Cc: Kevin Wolf, Andrey Korolyov, Stefan Hajnoczi, Max Reitz
Make block_resize safe for dataplane where another thread may be running
the BlockDriverState's AioContext.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
blockdev.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index 48bd9a3..197b799 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1799,6 +1799,7 @@ void qmp_block_resize(bool has_device, const char *device,
{
Error *local_err = NULL;
BlockDriverState *bs;
+ AioContext *aio_context;
int ret;
bs = bdrv_lookup_bs(has_device ? device : NULL,
@@ -1809,19 +1810,22 @@ void qmp_block_resize(bool has_device, const char *device,
return;
}
+ aio_context = bdrv_get_aio_context(bs);
+ aio_context_acquire(aio_context);
+
if (!bdrv_is_first_non_filter(bs)) {
error_set(errp, QERR_FEATURE_DISABLED, "resize");
- return;
+ goto out;
}
if (size < 0) {
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "size", "a >0 size");
- return;
+ goto out;
}
if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_RESIZE, NULL)) {
error_set(errp, QERR_DEVICE_IN_USE, device);
- return;
+ goto out;
}
/* complete all in-flight operations before resizing the device */
@@ -1847,6 +1851,9 @@ void qmp_block_resize(bool has_device, const char *device,
error_setg_errno(errp, -ret, "Could not resize");
break;
}
+
+out:
+ aio_context_release(aio_context);
}
static void block_job_cb(void *opaque, int ret)
--
1.9.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 2/2] virtio-blk: allow block_resize with dataplane
2014-08-18 13:52 [Qemu-devel] [PATCH 0/2] block: support block_resize with dataplane Stefan Hajnoczi
2014-08-18 13:52 ` [Qemu-devel] [PATCH 1/2] block: acquire AioContext in qmp_block_resize() Stefan Hajnoczi
@ 2014-08-18 13:52 ` Stefan Hajnoczi
2014-08-18 15:54 ` Max Reitz
2014-08-20 9:54 ` [Qemu-devel] [PATCH 0/2] block: support " Kevin Wolf
2 siblings, 1 reply; 6+ messages in thread
From: Stefan Hajnoczi @ 2014-08-18 13:52 UTC (permalink / raw)
To: qemu-devel; +Cc: Kevin Wolf, Andrey Korolyov, Stefan Hajnoczi, Max Reitz
Now that block_resize acquires the AioContext we can safely allow
resizing the disk.
Reported-by: Andrey Korolyov <andrey@xdel.ru>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
hw/block/dataplane/virtio-blk.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
index d6ba65c..b042caf 100644
--- a/hw/block/dataplane/virtio-blk.c
+++ b/hw/block/dataplane/virtio-blk.c
@@ -192,6 +192,7 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *blk,
error_setg(&s->blocker, "block device is in use by data plane");
bdrv_op_block_all(blk->conf.bs, s->blocker);
+ bdrv_op_unblock(blk->conf.bs, BLOCK_OP_TYPE_RESIZE, s->blocker);
*dataplane = s;
}
--
1.9.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] block: acquire AioContext in qmp_block_resize()
2014-08-18 13:52 ` [Qemu-devel] [PATCH 1/2] block: acquire AioContext in qmp_block_resize() Stefan Hajnoczi
@ 2014-08-18 15:54 ` Max Reitz
0 siblings, 0 replies; 6+ messages in thread
From: Max Reitz @ 2014-08-18 15:54 UTC (permalink / raw)
To: Stefan Hajnoczi, qemu-devel; +Cc: Kevin Wolf, Andrey Korolyov
On 18.08.2014 15:52, Stefan Hajnoczi wrote:
> Make block_resize safe for dataplane where another thread may be running
> the BlockDriverState's AioContext.
>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> blockdev.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
Reviewed-by: Max Reitz <mreitz@redhat.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] virtio-blk: allow block_resize with dataplane
2014-08-18 13:52 ` [Qemu-devel] [PATCH 2/2] virtio-blk: allow block_resize with dataplane Stefan Hajnoczi
@ 2014-08-18 15:54 ` Max Reitz
0 siblings, 0 replies; 6+ messages in thread
From: Max Reitz @ 2014-08-18 15:54 UTC (permalink / raw)
To: Stefan Hajnoczi, qemu-devel; +Cc: Kevin Wolf, Andrey Korolyov
On 18.08.2014 15:52, Stefan Hajnoczi wrote:
> Now that block_resize acquires the AioContext we can safely allow
> resizing the disk.
>
> Reported-by: Andrey Korolyov <andrey@xdel.ru>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> hw/block/dataplane/virtio-blk.c | 1 +
> 1 file changed, 1 insertion(+)
Reviewed-by: Max Reitz <mreitz@redhat.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] block: support block_resize with dataplane
2014-08-18 13:52 [Qemu-devel] [PATCH 0/2] block: support block_resize with dataplane Stefan Hajnoczi
2014-08-18 13:52 ` [Qemu-devel] [PATCH 1/2] block: acquire AioContext in qmp_block_resize() Stefan Hajnoczi
2014-08-18 13:52 ` [Qemu-devel] [PATCH 2/2] virtio-blk: allow block_resize with dataplane Stefan Hajnoczi
@ 2014-08-20 9:54 ` Kevin Wolf
2 siblings, 0 replies; 6+ messages in thread
From: Kevin Wolf @ 2014-08-20 9:54 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: Andrey Korolyov, qemu-devel, Max Reitz
Am 18.08.2014 um 15:52 hat Stefan Hajnoczi geschrieben:
> We have the op blocker and AioContext acquire/release infrastructure to safely
> allow block monitor commands on dataplane commands. It is now easy to make
> block_resize safe.
>
> Stefan Hajnoczi (2):
> block: acquire AioContext in qmp_block_resize()
> virtio-blk: allow block_resize with dataplane
>
> blockdev.c | 13 ++++++++++---
> hw/block/dataplane/virtio-blk.c | 1 +
> 2 files changed, 11 insertions(+), 3 deletions(-)
Thanks, applied all to the block branch.
Kevin
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-08-20 9:54 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-18 13:52 [Qemu-devel] [PATCH 0/2] block: support block_resize with dataplane Stefan Hajnoczi
2014-08-18 13:52 ` [Qemu-devel] [PATCH 1/2] block: acquire AioContext in qmp_block_resize() Stefan Hajnoczi
2014-08-18 15:54 ` Max Reitz
2014-08-18 13:52 ` [Qemu-devel] [PATCH 2/2] virtio-blk: allow block_resize with dataplane Stefan Hajnoczi
2014-08-18 15:54 ` Max Reitz
2014-08-20 9:54 ` [Qemu-devel] [PATCH 0/2] block: support " Kevin Wolf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).