aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-04-11 14:53:32 +0100
committerPeter Maydell <peter.maydell@linaro.org>2017-04-11 14:53:33 +0100
commitf5ac5cfeb67c31c2938419e71572d1cee2f9dd5e (patch)
tree4a9a1f180a593ff5a930250641862fcdea063c82
parentaa388ddc36e8032f41cd17bef88cc3ebaeba77c9 (diff)
parent2ec9a782d159e2bc6655fc0b783deda197bbe0b7 (diff)
Merge remote-tracking branch 'remotes/maxreitz/tags/pull-block-2017-04-11' into staging
Block patches for 2.9.0-rc4 # gpg: Signature made Tue 11 Apr 2017 14:40:07 BST # gpg: using RSA key 0xF407DB0061D5CF40 # gpg: Good signature from "Max Reitz <mreitz@redhat.com>" # Primary key fingerprint: 91BE B60A 30DB 3E88 57D1 1829 F407 DB00 61D5 CF40 * remotes/maxreitz/tags/pull-block-2017-04-11: iscsi: Fix iscsi_create throttle: Remove block from group on hot-unplug block: pass the right options for BlockDriver.bdrv_open() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--block/block-backend.c3
-rw-r--r--block/iscsi.c10
-rw-r--r--block/snapshot.c26
3 files changed, 34 insertions, 5 deletions
diff --git a/block/block-backend.c b/block/block-backend.c
index a8f2b3440f..7405024e08 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -231,6 +231,9 @@ static void blk_delete(BlockBackend *blk)
assert(!blk->refcnt);
assert(!blk->name);
assert(!blk->dev);
+ if (blk->public.throttle_state) {
+ blk_io_limits_disable(blk);
+ }
if (blk->root) {
blk_remove_bs(blk);
}
diff --git a/block/iscsi.c b/block/iscsi.c
index 716e74abba..42fb0b019c 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -2092,6 +2092,7 @@ static int iscsi_create(const char *filename, QemuOpts *opts, Error **errp)
BlockDriverState *bs;
IscsiLun *iscsilun = NULL;
QDict *bs_options;
+ Error *local_err = NULL;
bs = bdrv_new();
@@ -2102,8 +2103,13 @@ static int iscsi_create(const char *filename, QemuOpts *opts, Error **errp)
iscsilun = bs->opaque;
bs_options = qdict_new();
- qdict_put(bs_options, "filename", qstring_from_str(filename));
- ret = iscsi_open(bs, bs_options, 0, NULL);
+ iscsi_parse_filename(filename, bs_options, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ ret = -EINVAL;
+ } else {
+ ret = iscsi_open(bs, bs_options, 0, NULL);
+ }
QDECREF(bs_options);
if (ret != 0) {
diff --git a/block/snapshot.c b/block/snapshot.c
index bf5c2ca5e1..06b1185d27 100644
--- a/block/snapshot.c
+++ b/block/snapshot.c
@@ -27,6 +27,7 @@
#include "block/block_int.h"
#include "qapi/error.h"
#include "qapi/qmp/qerror.h"
+#include "qapi/qmp/qstring.h"
QemuOptsList internal_snapshot_opts = {
.name = "snapshot",
@@ -189,14 +190,33 @@ int bdrv_snapshot_goto(BlockDriverState *bs,
}
if (bs->file) {
+ BlockDriverState *file;
+ QDict *options = qdict_clone_shallow(bs->options);
+ QDict *file_options;
+
+ file = bs->file->bs;
+ /* Prevent it from getting deleted when detached from bs */
+ bdrv_ref(file);
+
+ qdict_extract_subqdict(options, &file_options, "file.");
+ QDECREF(file_options);
+ qdict_put(options, "file", qstring_from_str(bdrv_get_node_name(file)));
+
drv->bdrv_close(bs);
- ret = bdrv_snapshot_goto(bs->file->bs, snapshot_id);
- open_ret = drv->bdrv_open(bs, NULL, bs->open_flags, NULL);
+ bdrv_unref_child(bs, bs->file);
+ bs->file = NULL;
+
+ ret = bdrv_snapshot_goto(file, snapshot_id);
+ open_ret = drv->bdrv_open(bs, options, bs->open_flags, NULL);
+ QDECREF(options);
if (open_ret < 0) {
- bdrv_unref(bs->file->bs);
+ bdrv_unref(file);
bs->drv = NULL;
return open_ret;
}
+
+ assert(bs->file->bs == file);
+ bdrv_unref(file);
return ret;
}