Block patches for 2.9.0-rc4

-----BEGIN PGP SIGNATURE-----
 
 iQFGBAABCAAwFiEEkb62CjDbPohX0Rgp9AfbAGHVz0AFAljs3LcSHG1yZWl0ekBy
 ZWRoYXQuY29tAAoJEPQH2wBh1c9Ap5UIAL86fSzqRhpFE+327nah6krBvHaRtXRR
 vY+EuYEOAUotmxrBRqdXS6FB+yOHOCkSw3D3MDFoRoGIGFKEVB7i6WmS3esvsziO
 ziuoECU1d8R0HdfT4vqOwaTHqmkUNmwvjXvNN3myj0xpq2YNBL+vsuw7/Jb5bOPy
 j/AxCPgW8+hNjTT/OtAqQL15zSL46Xl5xH2SyksNUog2tOhw3j2C8VMBASP+apY1
 9wL/H8DcN7xExRQCeDCPZlGjPGfybxXqpbHC2blTt2PrPyRRwYmbM7mPAl+ilamG
 O5qThEKZUzU5VlWWB23C3jZksIXlOoeqvCGLabV775i9bRXtynC/9yA=
 =yblq
 -----END PGP SIGNATURE-----

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>
This commit is contained in:
Peter Maydell 2017-04-11 14:53:32 +01:00
commit f5ac5cfeb6
3 changed files with 34 additions and 5 deletions

View File

@ -231,6 +231,9 @@ static void blk_delete(BlockBackend *blk)
assert(!blk->refcnt); assert(!blk->refcnt);
assert(!blk->name); assert(!blk->name);
assert(!blk->dev); assert(!blk->dev);
if (blk->public.throttle_state) {
blk_io_limits_disable(blk);
}
if (blk->root) { if (blk->root) {
blk_remove_bs(blk); blk_remove_bs(blk);
} }

View File

@ -2092,6 +2092,7 @@ static int iscsi_create(const char *filename, QemuOpts *opts, Error **errp)
BlockDriverState *bs; BlockDriverState *bs;
IscsiLun *iscsilun = NULL; IscsiLun *iscsilun = NULL;
QDict *bs_options; QDict *bs_options;
Error *local_err = NULL;
bs = bdrv_new(); bs = bdrv_new();
@ -2102,8 +2103,13 @@ static int iscsi_create(const char *filename, QemuOpts *opts, Error **errp)
iscsilun = bs->opaque; iscsilun = bs->opaque;
bs_options = qdict_new(); bs_options = qdict_new();
qdict_put(bs_options, "filename", qstring_from_str(filename)); iscsi_parse_filename(filename, bs_options, &local_err);
ret = iscsi_open(bs, bs_options, 0, NULL); if (local_err) {
error_propagate(errp, local_err);
ret = -EINVAL;
} else {
ret = iscsi_open(bs, bs_options, 0, NULL);
}
QDECREF(bs_options); QDECREF(bs_options);
if (ret != 0) { if (ret != 0) {

View File

@ -27,6 +27,7 @@
#include "block/block_int.h" #include "block/block_int.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qapi/qmp/qerror.h" #include "qapi/qmp/qerror.h"
#include "qapi/qmp/qstring.h"
QemuOptsList internal_snapshot_opts = { QemuOptsList internal_snapshot_opts = {
.name = "snapshot", .name = "snapshot",
@ -189,14 +190,33 @@ int bdrv_snapshot_goto(BlockDriverState *bs,
} }
if (bs->file) { 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); drv->bdrv_close(bs);
ret = bdrv_snapshot_goto(bs->file->bs, snapshot_id); bdrv_unref_child(bs, bs->file);
open_ret = drv->bdrv_open(bs, NULL, bs->open_flags, NULL); 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) { if (open_ret < 0) {
bdrv_unref(bs->file->bs); bdrv_unref(file);
bs->drv = NULL; bs->drv = NULL;
return open_ret; return open_ret;
} }
assert(bs->file->bs == file);
bdrv_unref(file);
return ret; return ret;
} }