[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 17/37] block: check for existing device IDs in extern
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 17/37] block: check for existing device IDs in external_snapshot_prepare() |
Date: |
Thu, 5 Nov 2015 19:17:45 +0100 |
From: Alberto Garcia <address@hidden>
The 'snapshot-node-name' parameter of blockdev-snapshot-sync allows
setting the node name of the image that is going to be created.
Before creating the image, external_snapshot_prepare() checks that the
name is not already being used. The check is however incomplete since
it only considers existing node names, but node names must not clash
with device IDs either because they share the same namespace.
If the user attempts to create a snapshot using the name of an
existing device for the 'snapshot-node-name' parameter the operation
will eventually fail, but only after the new image has been created.
This patch replaces bdrv_find_node() with bdrv_lookup_bs() to extend
the check to existing device IDs, and thus detect possible name
clashes before the new image is created.
Signed-off-by: Alberto Garcia <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
blockdev.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index 005fcc5..2c2bf03 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1569,8 +1569,9 @@ static void external_snapshot_prepare(BlkTransactionState
*common,
return;
}
- if (has_snapshot_node_name && bdrv_find_node(snapshot_node_name)) {
- error_setg(errp, "New snapshot node name already existing");
+ if (has_snapshot_node_name &&
+ bdrv_lookup_bs(snapshot_node_name, snapshot_node_name, NULL)) {
+ error_setg(errp, "New snapshot node name already in use");
return;
}
--
1.8.3.1
- [Qemu-devel] [PULL 08/37] blockdev: Add blockdev-insert-medium, (continued)
- [Qemu-devel] [PULL 08/37] blockdev: Add blockdev-insert-medium, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 04/37] block: Add functions for inheriting a BBRS, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 11/37] block: Inquire tray state before tray-moved events, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 09/37] blockdev: Implement eject with basic operations, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 13/37] hmp: Use blockdev-change-medium for change command, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 15/37] hmp: Add read-only-mode option to change command, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 10/37] blockdev: Implement change with basic operations, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 14/37] blockdev: read-only-mode for blockdev-change-medium, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 19/37] block: support passing 'backing': '' to 'blockdev-add', Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 12/37] qmp: Introduce blockdev-change-medium, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 17/37] block: check for existing device IDs in external_snapshot_prepare(),
Kevin Wolf <=
- [Qemu-devel] [PULL 18/37] block: rename BlockdevSnapshot to BlockdevSnapshotSync, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 22/37] commit: reopen overlay_bs before base, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 21/37] block: add tests for the 'blockdev-snapshot' command, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 26/37] throttle: Check for pending requests in throttle_group_unregister_bs(), Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 23/37] qemu-iotests: Test the reopening of overlay_bs in 'block-commit', Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 25/37] qemu-img: add check for zero-length job len, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 24/37] qcow2: avoid misaligned 64bit bswap, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 27/37] throttle: Use bs->throttle_state instead of bs->io_limits_enabled, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 20/37] block: add a 'blockdev-snapshot' QMP command, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 16/37] iotests: Add test for change-related QMP commands, Kevin Wolf, 2015/11/05