diff mbox

[4/6] block: Add check on mirror target

Message ID 1433816027-32588-5-git-send-email-famz@redhat.com
State New
Headers show

Commit Message

Fam Zheng June 9, 2015, 2:13 a.m. UTC
Signed-off-by: Fam Zheng <famz@redhat.com>
---
 blockdev.c            | 3 +++
 include/block/block.h | 1 +
 2 files changed, 4 insertions(+)

Comments

Max Reitz June 24, 2015, 4:40 p.m. UTC | #1
On 09.06.2015 04:13, Fam Zheng wrote:
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>   blockdev.c            | 3 +++
>   include/block/block.h | 1 +
>   2 files changed, 4 insertions(+)

Reviewed-by: Max Reitz <mreitz@redhat.com>
diff mbox

Patch

diff --git a/blockdev.c b/blockdev.c
index c32a9a9..44030da 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2929,6 +2929,9 @@  static void blockdev_mirror_common(BlockDriverState *bs,
     if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_MIRROR_SOURCE, errp)) {
         return;
     }
+    if (bdrv_op_is_blocked(target, BLOCK_OP_TYPE_MIRROR_TARGET, errp)) {
+        return;
+    }
 
     if (!bs->backing_hd && sync == MIRROR_SYNC_MODE_TOP) {
         sync = MIRROR_SYNC_MODE_FULL;
diff --git a/include/block/block.h b/include/block/block.h
index 69cb676..c96d47b 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -156,6 +156,7 @@  typedef enum BlockOpType {
     BLOCK_OP_TYPE_INTERNAL_SNAPSHOT,
     BLOCK_OP_TYPE_INTERNAL_SNAPSHOT_DELETE,
     BLOCK_OP_TYPE_MIRROR_SOURCE,
+    BLOCK_OP_TYPE_MIRROR_TARGET,
     BLOCK_OP_TYPE_RESIZE,
     BLOCK_OP_TYPE_STREAM,
     BLOCK_OP_TYPE_REPLACE,