All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] block-commit: speed is an optional parameter
@ 2014-04-10 17:36 Max Reitz
  2014-04-11  1:09 ` [Qemu-devel] [Qemu-stable] " Fam Zheng
  2014-04-11 11:20 ` [Qemu-devel] " Kevin Wolf
  0 siblings, 2 replies; 4+ messages in thread
From: Max Reitz @ 2014-04-10 17:36 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, qemu-stable, Stefan Hajnoczi, Max Reitz

As speed is an optional parameter for the QMP block-commit command, it
should be set to 0 if not given (as it is undefined if has_speed is
false), that is, the speed should not be limited.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
This patch was previously part of the "qemu-img: Implement commit like
QMP" series, but as this is a general bugfix, it has been separated.
---
 blockdev.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/blockdev.c b/blockdev.c
index c3422a1..5dd01ea 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1876,6 +1876,10 @@ void qmp_block_commit(const char *device,
      */
     BlockdevOnError on_error = BLOCKDEV_ON_ERROR_REPORT;
 
+    if (!has_speed) {
+        speed = 0;
+    }
+
     /* drain all i/o before commits */
     bdrv_drain_all();
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [Qemu-stable] [PATCH] block-commit: speed is an optional parameter
  2014-04-10 17:36 [Qemu-devel] [PATCH] block-commit: speed is an optional parameter Max Reitz
@ 2014-04-11  1:09 ` Fam Zheng
  2014-04-11  1:38   ` Eric Blake
  2014-04-11 11:20 ` [Qemu-devel] " Kevin Wolf
  1 sibling, 1 reply; 4+ messages in thread
From: Fam Zheng @ 2014-04-11  1:09 UTC (permalink / raw)
  To: Max Reitz; +Cc: Kevin Wolf, qemu-devel, Stefan Hajnoczi, qemu-stable

On Thu, 04/10 19:36, Max Reitz wrote:
> As speed is an optional parameter for the QMP block-commit command, it
> should be set to 0 if not given (as it is undefined if has_speed is
> false), that is, the speed should not be limited.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> Reviewed-by: Eric Blake <eblake@redhat.com>
> ---
> This patch was previously part of the "qemu-img: Implement commit like
> QMP" series, but as this is a general bugfix, it has been separated.
> ---

Reviewed-by: Fam Zheng <famz@redhat.com>

The (generated) caller qmp_marshal_input_block_commit() actually leaves speed
uninitialized, so we're not safe without this patch:

int qmp_marshal_input_block_commit(Monitor *mon, const QDict *qdict, QObject **ret)
{
    Error *local_err = NULL;
    Error **errp = &local_err;
    QDict *args = (QDict *)qdict;
    QmpInputVisitor *mi;
    QapiDeallocVisitor *md;
    Visitor *v;
    char * device = NULL;
    bool has_base = false;
    char * base = NULL;
    char * top = NULL;
    bool has_speed = false;
    int64_t speed;

I'm wondering what the reason is to initialize pointers (like base and device)
while leaving int64_t values uninitilized in the code generator?

Fam

>  blockdev.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/blockdev.c b/blockdev.c
> index c3422a1..5dd01ea 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -1876,6 +1876,10 @@ void qmp_block_commit(const char *device,
>       */
>      BlockdevOnError on_error = BLOCKDEV_ON_ERROR_REPORT;
>  
> +    if (!has_speed) {
> +        speed = 0;
> +    }
> +
>      /* drain all i/o before commits */
>      bdrv_drain_all();
>  
> -- 
> 1.9.1
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [Qemu-stable] [PATCH] block-commit: speed is an optional parameter
  2014-04-11  1:09 ` [Qemu-devel] [Qemu-stable] " Fam Zheng
@ 2014-04-11  1:38   ` Eric Blake
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Blake @ 2014-04-11  1:38 UTC (permalink / raw)
  To: Fam Zheng, Max Reitz; +Cc: Kevin Wolf, qemu-devel, Stefan Hajnoczi, qemu-stable

[-- Attachment #1: Type: text/plain, Size: 1118 bytes --]

On 04/10/2014 07:09 PM, Fam Zheng wrote:
> On Thu, 04/10 19:36, Max Reitz wrote:
>> As speed is an optional parameter for the QMP block-commit command, it
>> should be set to 0 if not given (as it is undefined if has_speed is
>> false), that is, the speed should not be limited.
>>
>> Signed-off-by: Max Reitz <mreitz@redhat.com>
>> Reviewed-by: Eric Blake <eblake@redhat.com>
>> ---
>> This patch was previously part of the "qemu-img: Implement commit like
>> QMP" series, but as this is a general bugfix, it has been separated.
>> ---
> 
> Reviewed-by: Fam Zheng <famz@redhat.com>
> 
> The (generated) caller qmp_marshal_input_block_commit() actually leaves speed
> uninitialized, so we're not safe without this patch:

> I'm wondering what the reason is to initialize pointers (like base and device)
> while leaving int64_t values uninitilized in the code generator?

Because no one has applied this patch yet:

https://lists.gnu.org/archive/html/qemu-devel/2014-03/msg04224.html

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] block-commit: speed is an optional parameter
  2014-04-10 17:36 [Qemu-devel] [PATCH] block-commit: speed is an optional parameter Max Reitz
  2014-04-11  1:09 ` [Qemu-devel] [Qemu-stable] " Fam Zheng
@ 2014-04-11 11:20 ` Kevin Wolf
  1 sibling, 0 replies; 4+ messages in thread
From: Kevin Wolf @ 2014-04-11 11:20 UTC (permalink / raw)
  To: Max Reitz; +Cc: qemu-devel, Stefan Hajnoczi, qemu-stable

Am 10.04.2014 um 19:36 hat Max Reitz geschrieben:
> As speed is an optional parameter for the QMP block-commit command, it
> should be set to 0 if not given (as it is undefined if has_speed is
> false), that is, the speed should not be limited.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> Reviewed-by: Eric Blake <eblake@redhat.com>
> ---
> This patch was previously part of the "qemu-img: Implement commit like
> QMP" series, but as this is a general bugfix, it has been separated.

Thanks, applied to the block branch.

In future patches, please add an explicit 'Cc: qemu-stable@nongnu.org'
line to the commit message so that the stable maintainers can grep in
git log for candidates. I added it manually while applying.

Kevin

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-04-11 11:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-10 17:36 [Qemu-devel] [PATCH] block-commit: speed is an optional parameter Max Reitz
2014-04-11  1:09 ` [Qemu-devel] [Qemu-stable] " Fam Zheng
2014-04-11  1:38   ` Eric Blake
2014-04-11 11:20 ` [Qemu-devel] " Kevin Wolf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.