summaryrefslogtreecommitdiff
path: root/blockdev.c
diff options
context:
space:
mode:
authorAlyssa Milburn <fuzzie@fuzzie.org>2016-02-06 13:36:18 +0000
committerMax Reitz <mreitz@redhat.com>2016-02-22 16:54:14 +0100
commit156abc2f901617834307d93f3c066250957f75b1 (patch)
treee56698026fe837593a7af131e63aef7ac23d02e8 /blockdev.c
parentd310d85bf4472b6af9ff0235d397014dad713b8c (diff)
downloadqemu-156abc2f901617834307d93f3c066250957f75b1.tar.gz
blockdev: unset inappropriate flags when changing medium
Most importantly, this removes BDRV_O_TEMPORARY, to avoid unlink()ing an image which replaces a snapshotted one. Signed-off-by: Alyssa Milburn <fuzzie@fuzzie.org> Message-id: 20160206133618.GA16635@li141-249.members.linode.com Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/blockdev.c b/blockdev.c
index 5c02a4289c..d4bc435940 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2513,6 +2513,8 @@ void qmp_blockdev_change_medium(const char *device, const char *filename,
}
bdrv_flags = blk_get_open_flags_from_root_state(blk);
+ bdrv_flags &= ~(BDRV_O_TEMPORARY | BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING |
+ BDRV_O_PROTOCOL);
if (!has_read_only) {
read_only = BLOCKDEV_CHANGE_READ_ONLY_MODE_RETAIN;