[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 11/29] block: Check blockers in all nodes involved in
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 11/29] block: Check blockers in all nodes involved in a block-commit job |
Date: |
Mon, 31 Oct 2016 18:25:40 +0100 |
From: Alberto Garcia <address@hidden>
qmp_block_commit() checks for op blockers in the active and
destination (base) images. However all nodes between top_bs and base
are also involved, and they are removed from the chain afterwards.
In addition to that, if top_bs is not the active layer then top_bs's
overlay also needs to be checked because it's involved in the job (its
backing image string needs to be updated to point to 'base').
This patch checks that none of those nodes are blocked.
Signed-off-by: Alberto Garcia <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
blockdev.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index d11a74f..de5b5f5 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -3001,6 +3001,7 @@ void qmp_block_commit(bool has_job_id, const char
*job_id, const char *device,
Error **errp)
{
BlockDriverState *bs;
+ BlockDriverState *iter;
BlockDriverState *base_bs, *top_bs;
AioContext *aio_context;
Error *local_err = NULL;
@@ -3067,8 +3068,10 @@ void qmp_block_commit(bool has_job_id, const char
*job_id, const char *device,
assert(bdrv_get_aio_context(base_bs) == aio_context);
- if (bdrv_op_is_blocked(base_bs, BLOCK_OP_TYPE_COMMIT_TARGET, errp)) {
- goto out;
+ for (iter = top_bs; iter != backing_bs(base_bs); iter = backing_bs(iter)) {
+ if (bdrv_op_is_blocked(iter, BLOCK_OP_TYPE_COMMIT_TARGET, errp)) {
+ goto out;
+ }
}
/* Do not allow attempts to commit an image into itself */
@@ -3086,6 +3089,10 @@ void qmp_block_commit(bool has_job_id, const char
*job_id, const char *device,
commit_active_start(has_job_id ? job_id : NULL, bs, base_bs, speed,
on_error, block_job_cb, bs, &local_err, false);
} else {
+ BlockDriverState *overlay_bs = bdrv_find_overlay(bs, top_bs);
+ if (bdrv_op_is_blocked(overlay_bs, BLOCK_OP_TYPE_COMMIT_TARGET, errp))
{
+ goto out;
+ }
commit_start(has_job_id ? job_id : NULL, bs, base_bs, top_bs, speed,
on_error, block_job_cb, bs,
has_backing_file ? backing_file : NULL, &local_err);
--
1.8.3.1
- [Qemu-devel] [PULL 04/29] block/ssh: Use InetSocketAddress options, (continued)
- [Qemu-devel] [PULL 04/29] block/ssh: Use InetSocketAddress options, Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 05/29] qapi: allow blockdev-add for ssh, Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 06/29] block: Add bdrv_drain_all_{begin,end}(), Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 02/29] util/qemu-sockets: Make inet_connect_saddr() public, Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 01/29] block/ssh: Add ssh_has_filename_options_conflict(), Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 07/29] block: Pause all jobs during bdrv_reopen_multiple(), Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 08/29] block: Add block_job_add_bdrv(), Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 09/29] block: Use block_job_add_bdrv() in mirror_start_job(), Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 10/29] block: Use block_job_add_bdrv() in backup_start(), Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 03/29] block/ssh: Add InetSocketAddress and accept it, Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 11/29] block: Check blockers in all nodes involved in a block-commit job,
Kevin Wolf <=
- [Qemu-devel] [PULL 14/29] block: Support streaming to an intermediate layer, Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 13/29] block: Block all intermediate nodes in commit_active_start(), Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 15/29] block: Add QMP support for streaming to an intermediate layer, Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 12/29] block: Block all nodes involved in the block-commit operation, Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 16/29] docs: Document how to stream to an intermediate layer, Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 17/29] qemu-iotests: Test streaming to an intermediate layer, Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 18/29] qemu-iotests: Test block-stream operations in parallel, Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 22/29] qemu-iotests: Test streaming to a Quorum child, Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 20/29] qemu-iotests: Test block-stream and block-commit in parallel, Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 21/29] qemu-iotests: Add iotests.supports_quorum(), Kevin Wolf, 2016/10/31