[PATCH 2/2] qemuBackupBegin: Fix monitor access when rolling back due to failure

Peter Krempa posted 2 patches 5 years, 10 months ago
[PATCH 2/2] qemuBackupBegin: Fix monitor access when rolling back due to failure
Posted by Peter Krempa 5 years, 10 months ago
The code attempting to clean up after a failed pull mode backup job
wrongly entered monitor but didn't clean up nor exit monitor due to a
logic bug. Fix the condition.

https://bugzilla.redhat.com/show_bug.cgi?id=1817327

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/qemu/qemu_backup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c
index 8b66ee8d1f..9a056fa407 100644
--- a/src/qemu/qemu_backup.c
+++ b/src/qemu/qemu_backup.c
@@ -894,7 +894,7 @@ qemuBackupBegin(virDomainObjPtr vm,
     qemuCheckpointRollbackMetadata(vm, chk);

     if (!job_started && nbd_running &&
-        qemuDomainObjEnterMonitorAsync(priv->driver, vm, QEMU_ASYNC_JOB_BACKUP) < 0) {
+        qemuDomainObjEnterMonitorAsync(priv->driver, vm, QEMU_ASYNC_JOB_BACKUP) == 0) {
         ignore_value(qemuMonitorNBDServerStop(priv->mon));
         ignore_value(qemuDomainObjExitMonitor(priv->driver, vm));
     }
-- 
2.24.1

Re: [PATCH 2/2] qemuBackupBegin: Fix monitor access when rolling back due to failure
Posted by Eric Blake 5 years, 10 months ago
On 3/26/20 9:54 AM, Peter Krempa wrote:
> The code attempting to clean up after a failed pull mode backup job
> wrongly entered monitor but didn't clean up nor exit monitor due to a
> logic bug. Fix the condition.
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1817327
> 
> Signed-off-by: Peter Krempa <pkrempa@redhat.com>

Would be nice to mention which commit id introduced the bug.

> ---
>   src/qemu/qemu_backup.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

> 
> diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c
> index 8b66ee8d1f..9a056fa407 100644
> --- a/src/qemu/qemu_backup.c
> +++ b/src/qemu/qemu_backup.c
> @@ -894,7 +894,7 @@ qemuBackupBegin(virDomainObjPtr vm,
>       qemuCheckpointRollbackMetadata(vm, chk);
> 
>       if (!job_started && nbd_running &&
> -        qemuDomainObjEnterMonitorAsync(priv->driver, vm, QEMU_ASYNC_JOB_BACKUP) < 0) {
> +        qemuDomainObjEnterMonitorAsync(priv->driver, vm, QEMU_ASYNC_JOB_BACKUP) == 0) {
>           ignore_value(qemuMonitorNBDServerStop(priv->mon));
>           ignore_value(qemuDomainObjExitMonitor(priv->driver, vm));
>       }
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Re: [PATCH 2/2] qemuBackupBegin: Fix monitor access when rolling back due to failure
Posted by Peter Krempa 5 years, 10 months ago
On Thu, Mar 26, 2020 at 11:21:37 -0500, Eric Blake wrote:
> On 3/26/20 9:54 AM, Peter Krempa wrote:
> > The code attempting to clean up after a failed pull mode backup job
> > wrongly entered monitor but didn't clean up nor exit monitor due to a
> > logic bug. Fix the condition.
> > 
> > https://bugzilla.redhat.com/show_bug.cgi?id=1817327
> > 
> > Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> 
> Would be nice to mention which commit id introduced the bug.

Well, in this case you'll be fishing it out of a ~1k line additions
patch as it was introduced right together when the backup api
implementation was added in a1521f84a53.

I'll add the mention, but I didn't find it useful in this case.