[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 20/21] blockdev: move BDRV_O_NO_BACKING option forwar
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 20/21] blockdev: move BDRV_O_NO_BACKING option forward |
Date: |
Tue, 18 Jul 2017 16:18:05 +0200 |
From: John Snow <address@hidden>
For both external_snapshot_prepare and qmp_drive_mirror, we eventually
append the option BDRV_O_NO_BACKING. However, we generally do so after
we create the image.
To accommodate image creation wanting to verify that a backing file
exists or not, add this option prior to create to override checking
the existence of the backing file. This prevents QEMU from trying to
re-open a backing file that's already in use (thanks to qcow2 locking).
Signed-off-by: John Snow <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
blockdev.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index 7f53cc8..6469f16 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1710,7 +1710,8 @@ static void external_snapshot_prepare(BlkActionState
*common,
}
flags = state->old_bs->open_flags;
- flags &= ~(BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING | BDRV_O_COPY_ON_READ);
+ flags &= ~(BDRV_O_SNAPSHOT | BDRV_O_COPY_ON_READ);
+ flags |= BDRV_O_NO_BACKING;
/* create new image w/backing file */
mode = s->has_mode ? s->mode : NEW_IMAGE_MODE_ABSOLUTE_PATHS;
@@ -1735,8 +1736,6 @@ static void external_snapshot_prepare(BlkActionState
*common,
qdict_put_str(options, "node-name", snapshot_node_name);
}
qdict_put_str(options, "driver", format);
-
- flags |= BDRV_O_NO_BACKING;
}
state->new_bs = bdrv_open(new_image_file, snapshot_ref, options, flags,
@@ -3548,6 +3547,9 @@ void qmp_drive_mirror(DriveMirror *arg, Error **errp)
backing_mode = MIRROR_OPEN_BACKING_CHAIN;
}
+ /* Don't open backing image in create() */
+ flags |= BDRV_O_NO_BACKING;
+
if ((arg->sync == MIRROR_SYNC_MODE_FULL || !source)
&& arg->mode != NEW_IMAGE_MODE_EXISTING)
{
@@ -3587,8 +3589,7 @@ void qmp_drive_mirror(DriveMirror *arg, Error **errp)
/* Mirroring takes care of copy-on-write using the source's backing
* file.
*/
- target_bs = bdrv_open(arg->target, NULL, options,
- flags | BDRV_O_NO_BACKING, errp);
+ target_bs = bdrv_open(arg->target, NULL, options, flags, errp);
if (!target_bs) {
goto out;
}
--
1.8.3.1
- [Qemu-block] [PULL 07/21] block/qapi: Add qdev device name to query-block, (continued)
- [Qemu-block] [PULL 07/21] block/qapi: Add qdev device name to query-block, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 10/21] block: List anonymous device BBs in query-block, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 11/21] ide: bdrv_attach_dev() for empty CD-ROM, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 12/21] scsi-disk: bdrv_attach_dev() for empty CD-ROM, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 14/21] qemu-iotests: Test unplug of -device without drive, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 16/21] vvfat: add a constant for bootsector name, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 13/21] qemu-iotests: Test 'info block', Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 17/21] vvfat: correctly parse non-ASCII short and long file names, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 15/21] vvfat: add constants for special values of name[0], Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 19/21] block/vvfat: Fix compiler warning with gcc 7, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 20/21] blockdev: move BDRV_O_NO_BACKING option forward,
Kevin Wolf <=
- [Qemu-block] [PULL 18/21] vvfat: initialize memory after allocating it, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 21/21] qemu-img: Check for backing image if specified during create, Kevin Wolf, 2017/07/18
- Re: [Qemu-block] [Qemu-devel] [PULL 00/21] Block layer patches, no-reply, 2017/07/18
- Re: [Qemu-block] [Qemu-devel] [PULL 00/21] Block layer patches, no-reply, 2017/07/18
- Re: [Qemu-block] [PULL 00/21] Block layer patches, Peter Maydell, 2017/07/19