From d81e1efbea7d19c2f142d300df56538c73800590 Mon Sep 17 00:00:00 2001 From: John Snow Date: Thu, 23 May 2019 13:06:39 -0400 Subject: blockdev-backup: don't check aio_context too early in blockdev_backup_prepare, we check to make sure that the target is associated with a compatible aio context. However, do_blockdev_backup is called later and has some logic to move the target to a compatible aio_context. The transaction version will fail certain commands needlessly early as a result. Allow blockdev_backup_prepare to simply call do_blockdev_backup, which will ultimately decide if the contexts are compatible or not. Note: the transaction version has always disallowed this operation since its initial commit bd8baecd (2014), whereas the version of qmp_blockdev_backup at the time, from commit c29c1dd312f, tried to enforce the aio_context switch instead. It's not clear, and I can't see from the mailing list archives at the time, why the two functions take a different approach. It wasn't until later in efd7556708b (2016) that the standalone version tried to determine if it could set the context or not. Reported-by: aihua liang Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1683498 Signed-off-by: John Snow Message-id: 20190523170643.20794-2-jsnow@redhat.com Reviewed-by: Max Reitz Signed-off-by: Max Reitz --- blockdev.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'blockdev.c') diff --git a/blockdev.c b/blockdev.c index 3f44b891eb..fdafa173cc 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1876,10 +1876,6 @@ static void blockdev_backup_prepare(BlkActionState *common, Error **errp) } aio_context = bdrv_get_aio_context(bs); - if (aio_context != bdrv_get_aio_context(target)) { - error_setg(errp, "Backup between two IO threads is not implemented"); - return; - } aio_context_acquire(aio_context); state->bs = bs; -- cgit 1.4.1 From a2bb6f8c920066fba7bd3fdddf214ea40c0fafab Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Mon, 3 Jun 2019 22:22:36 +0200 Subject: blockdev: Overlays are not snapshots There are error messages which refer to an overlay node as the snapshot. That is wrong, those are two different things. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Message-id: 20190603202236.1342-3-mreitz@redhat.com Reviewed-by: John Snow Reviewed-by: Alberto Garcia Signed-off-by: Max Reitz --- blockdev.c | 10 +++++----- tests/qemu-iotests/085.out | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'blockdev.c') diff --git a/blockdev.c b/blockdev.c index fdafa173cc..b5c0fd3c49 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1608,13 +1608,13 @@ static void external_snapshot_prepare(BlkActionState *common, s->has_snapshot_node_name ? s->snapshot_node_name : NULL; if (node_name && !snapshot_node_name) { - error_setg(errp, "New snapshot node name missing"); + error_setg(errp, "New overlay node name missing"); goto out; } if (snapshot_node_name && bdrv_lookup_bs(snapshot_node_name, snapshot_node_name, NULL)) { - error_setg(errp, "New snapshot node name already in use"); + error_setg(errp, "New overlay node name already in use"); goto out; } @@ -1656,7 +1656,7 @@ static void external_snapshot_prepare(BlkActionState *common, } if (bdrv_has_blk(state->new_bs)) { - error_setg(errp, "The snapshot is already in use"); + error_setg(errp, "The overlay is already in use"); goto out; } @@ -1666,12 +1666,12 @@ static void external_snapshot_prepare(BlkActionState *common, } if (state->new_bs->backing != NULL) { - error_setg(errp, "The snapshot already has a backing image"); + error_setg(errp, "The overlay already has a backing image"); goto out; } if (!state->new_bs->drv->supports_backing) { - error_setg(errp, "The snapshot does not support backing images"); + error_setg(errp, "The overlay does not support backing images"); goto out; } diff --git a/tests/qemu-iotests/085.out b/tests/qemu-iotests/085.out index 6edf107f55..2a5f256cd3 100644 --- a/tests/qemu-iotests/085.out +++ b/tests/qemu-iotests/085.out @@ -64,13 +64,13 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/ === Invalid command - cannot create a snapshot using a file BDS === -{"error": {"class": "GenericError", "desc": "The snapshot does not support backing images"}} +{"error": {"class": "GenericError", "desc": "The overlay does not support backing images"}} === Invalid command - snapshot node used as active layer === -{"error": {"class": "GenericError", "desc": "The snapshot is already in use"}} -{"error": {"class": "GenericError", "desc": "The snapshot is already in use"}} -{"error": {"class": "GenericError", "desc": "The snapshot is already in use"}} +{"error": {"class": "GenericError", "desc": "The overlay is already in use"}} +{"error": {"class": "GenericError", "desc": "The overlay is already in use"}} +{"error": {"class": "GenericError", "desc": "The overlay is already in use"}} === Invalid command - snapshot node used as backing hd === @@ -81,7 +81,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/ Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=134217728 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/t.IMGFMT.base {"return": {}} -{"error": {"class": "GenericError", "desc": "The snapshot already has a backing image"}} +{"error": {"class": "GenericError", "desc": "The overlay already has a backing image"}} === Invalid command - The node does not exist === -- cgit 1.4.1