aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2017-12-15 16:04:45 +0800
committerKevin Wolf <kwolf@redhat.com>2017-12-22 15:03:41 +0100
commitcc954f01e3c004aad081aa36736a17e842b80211 (patch)
treeeef52c34f276f7c4f3593a6b23f44a97bc101741 /block.c
parent1ee24514aed34760fb2863d98bea3a1b705d9c9f (diff)
downloadqemu-cc954f01e3c004aad081aa36736a17e842b80211.zip
qemu-cc954f01e3c004aad081aa36736a17e842b80211.tar.gz
qemu-cc954f01e3c004aad081aa36736a17e842b80211.tar.bz2
block: Open backing image in force share mode for size probe
Management tools create overlays of running guests with qemu-img: $ qemu-img create -b /image/in/use.qcow2 -f qcow2 /overlay/image.qcow2 but this doesn't work anymore due to image locking: qemu-img: /overlay/image.qcow2: Failed to get shared "write" lock Is another process using the image? Could not open backing image to determine size. Use the force share option to allow this use case again. Cc: qemu-stable@nongnu.org Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/block.c b/block.c
index db0be7e..dd90dca 100644
--- a/block.c
+++ b/block.c
@@ -4605,10 +4605,11 @@ void bdrv_img_create(const char *filename, const char *fmt,
back_flags = flags;
back_flags &= ~(BDRV_O_RDWR | BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING);
+ backing_options = qdict_new();
if (backing_fmt) {
- backing_options = qdict_new();
qdict_put_str(backing_options, "driver", backing_fmt);
}
+ qdict_put_bool(backing_options, BDRV_OPT_FORCE_SHARE, true);
bs = bdrv_open(full_backing, NULL, backing_options, back_flags,
&local_err);