Block layer patches for 2.6
[Qemu-devel] [PULL 1/4] block: forbid x-blockdev-del from acting on DriveInfo
In reply to Kevin WolfFrom: Paolo Bonzini <[email protected]>
Failing on -drive/drive_add created BlockBackends was a requirement for x-blockdev-del, but it sneaked through the patch review. Let's fix it now.
Example:
$ x86_64-softmmu/qemu-system-x86_64 -drive if=none,file=null-co://,id=null -qmp stdio
Quoted 1 line
Quoted 1 line
{'execute':'qmp_capabilities'}
<< {"return": {}}
Quoted 1 line
Quoted 1 line
{'execute':'x-blockdev-del','arguments':{'id':'null'}}
<< {"error": {"class": "GenericError", "desc": "Deleting block backend added with drive-add is not supported"}}
And without a DriveInfo:
Quoted 1 line
Quoted 1 line
{ "execute": "blockdev-add", "arguments": { "options": { "driver":"null-co", "id":"null2"}}}
<< {"return": {}}
Quoted 1 line
Quoted 1 line
{'execute':'x-blockdev-del','arguments':{'id':'null2'}}
<< {"return": {}}
--- blockdev.c | 5 +++++ 1 file changed, 5 insertions(+)
blockdev.c +5 -0
@@ -4027,6 +4027,11 @@ void qmp_x_blockdev_del(bool has_id, const char *id,error_setg (errp,"Cannot find block backend %s" , id);return ; } +if (blk_legacy_dinfo (blk)) { +error_setg (errp,"Deleting block backend added with drive-add" +" is not supported" ); +return ; + }if (blk_get_refcnt (blk) >1 ) {error_setg (errp,"Block backend %s is in use" , id);return ;
Signature · 1 line
1.8.3.1
The following changes since commit 2e3a76ae3e47d502f9f0c4424b719945fba9d459:
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20160404' into staging (2016-04-04 17:43:39 +0100)
are available in the git repository at:
git://repo.or.cz/qemu/kevin.git tags/for-upstream
for you to fetch changes up to 6a5c357fdbd4c91c5142f1b7ccf4658664b52ea2:
Merge remote-tracking branch 'mreitz/tags/pull-block-for-kevin-2016-04-05' into queue-block (2016-04-05 17:31:20 +0200)
----------------------------------------------------------------
Block layer patches for 2.6
----------------------------------------------------------------
Eric Blake (1):
crypto: Avoid memory leak on failure
Fam Zheng (1):
qemu-iotests: 149: Use "/usr/bin/env python"
Kevin Wolf (2):
block: Forbid I/O throttling on nodes with multiple parents for 2.6
Merge remote-tracking branch 'mreitz/tags/pull-block-for-kevin-2016-04-05' into queue-block
Paolo Bonzini (1):
block: forbid x-blockdev-del from acting on DriveInfo
block.c | 7 +++++++ block/crypto.c | 12 ++++++------ blockdev.c | 12 ++++++++++++ tests/qemu-iotests/149 | 2 +- 4 files changed, 26 insertions(+), 7 deletions(-)
[Qemu-devel] [PULL 4/4] crypto: Avoid memory leak on failure
From: Eric Blake <[email protected]>
Commit 7836857 introduced a memory leak due to invalid use of Error vs. visit_type_end(). If visiting the intermediate members fails, we clear the error and unconditionally use visit_end_struct() on the same error object; but if that cleanup succeeds, we then skip the qapi_free call.
Until a later patch adds visit_check_struct(), the only safe approach is to use two separate error objects.
Message-id: [email protected]
--- block/crypto.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
block/crypto.c +6 -6
@@ -196,6 +196,7 @@ block_crypto_open_opts_init(QCryptoBlockFormat format,OptsVisitor *ov;QCryptoBlockOpenOptions *ret =NULL ;Error *local_err =NULL ; +Error *end_err =NULL ; ret =g_new0 (QCryptoBlockOpenOptions,1 ); ret->format = format;
@@ -218,10 +219,9 @@ block_crypto_open_opts_init(QCryptoBlockFormat format,error_setg (&local_err,"Unsupported block format %d" , format);break ; } -error_propagate (errp, local_err); - local_err =NULL ; -visit_end_struct (opts_get_visitor (ov), &local_err); +visit_end_struct (opts_get_visitor (ov), &end_err); +error_propagate (&local_err, end_err); out:if (local_err) {
@@ -242,6 +242,7 @@ block_crypto_create_opts_init(QCryptoBlockFormat format,OptsVisitor *ov;QCryptoBlockCreateOptions *ret =NULL ;Error *local_err =NULL ; +Error *end_err =NULL ; ret =g_new0 (QCryptoBlockCreateOptions,1 ); ret->format = format;
@@ -264,10 +265,9 @@ block_crypto_create_opts_init(QCryptoBlockFormat format,error_setg (&local_err,"Unsupported block format %d" , format);break ; } -error_propagate (errp, local_err); - local_err =NULL ; -visit_end_struct (opts_get_visitor (ov), &local_err); +visit_end_struct (opts_get_visitor (ov), &end_err); +error_propagate (&local_err, end_err); out:if (local_err) {
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 3/4] qemu-iotests: 149: Use "/usr/bin/env python"
In reply to Kevin WolfFrom: Fam Zheng <[email protected]>
Do the same as other scripts, to pick the correct interpreter between python2 and python3 from the environment.
Message-id: [email protected]
--- tests/qemu-iotests/149 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qemu-iotests/149 +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # # Copyright (C) 2016 Red Hat, Inc. #
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 2/4] block: Forbid I/O throttling on nodes with multiple parents for 2.6
In reply to Kevin WolfAs the patches to move I/O throttling to BlockBackend didn't make it in time for the 2.6 release, but the release adds new ways of configuring VMs whose behaviour would change once the move is done, we need to outlaw such configurations temporarily.
The problem exists whenever a BDS has more users than just its BB, for example it is used as a backing file for another node. (This wasn't possible in 2.5 yet as we introduced node references to specify a backing file only recently.) In these cases, the throttling would apply to these other users now, but after moving throttling to the BlockBackend the other users wouldn't be throttled any more.
This patch prevents making new references to a throttled node as well as using monitor commands to throttle a node with multiple parents.
Compared to 2.5 this changes behaviour in some corner cases where references were allowed before, like bs->file or Quorum children. It seems reasonable to assume that users didn't use I/O throttling on such low level nodes. With the upcoming move of throttling into BlockBackend, such configurations won't be possible anyway.
--- block.c | 7 +++++++ blockdev.c | 7 +++++++ 2 files changed, 14 insertions(+)
block.c +7 -0
@@ -1526,6 +1526,13 @@ static int bdrv_open_inherit(BlockDriverState **pbs, const char *filename,if (!bs) {return -ENODEV ; } + +if (bs->throttle_state) { +error_setg (errp,"Cannot reference an existing block device for " +"which I/O throttling is enabled" ); +return -EINVAL ; + } +bdrv_ref (bs); *pbs = bs;return 0 ;
blockdev.c +7 -0
@@ -2661,6 +2661,13 @@ void qmp_block_set_io_throttle(const char *device, int64_t bps, int64_t bps_rd, goto out; } +/* The BlockBackend must be the only parent */ +assert (QLIST_FIRST (&bs->parents)); +if (QLIST_NEXT (QLIST_FIRST (&bs->parents), next_parent)) { +error_setg (errp,"Cannot throttle device with multiple parents" ); + goto out; + } +throttle_config_init (&cfg); cfg.buckets[THROTTLE_BPS_TOTAL ].avg = bps; cfg.buckets[THROTTLE_BPS_READ ].avg = bps_rd;
Signature · 1 line
1.8.3.1
Peter Maydell
AppliedQuoted 11 lines · Kevin Wolf
The following changes since commit
2e3a76ae3e47d502f9f0c4424b719945fba9d459:Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20160404' into staging (2016-04-04 17:43:39 +0100)
are available in the git repository at:
git://repo.or.cz/qemu/kevin.gittags/for-upstreamfor you to fetch changes up to
6a5c357fdbd4c91c5142f1b7ccf4658664b52ea2:
Quoted 7 lines
Merge remote-tracking branch 'mreitz/tags/pull-block-for-kevin-2016-04-05' into queue-block (2016-04-05 17:31:20 +0200)
----------------------------------------------------------------
Block layer patches for 2.6
----------------------------------------------------------------
Applied, thanks.
-- PMM