* [PATCH v2 2/3] migration/savevm: respect qemu_fclose() error code in save_snapshot()
2020-07-13 15:58 [PATCH v2 0/3] Migration Pull request Juan Quintela
@ 2020-07-13 15:58 ` Juan Quintela
2020-07-13 15:58 ` [PATCH v2 3/3] migration/migration.c: Remove superfluous breaks Juan Quintela
1 sibling, 0 replies; 3+ messages in thread
From: Juan Quintela @ 2020-07-13 15:58 UTC (permalink / raw)
To: qemu-devel
Cc: Kevin Wolf, Fam Zheng, Vladimir Sementsov-Ogievskiy,
Juan Quintela, Dr. David Alan Gilbert, Max Reitz, Denis Plotnikov,
quintela, Stefan Hajnoczi, Denis V. Lunev
From: "Denis V. Lunev" <den@openvz.org>
qemu_fclose() could return error, f.e. if bdrv_co_flush() will return
the error.
This validation will become more important once we will start waiting of
asynchronous IO operations, started from bdrv_write_vmstate(), which are
coming soon.
Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
CC: Kevin Wolf <kwolf@redhat.com>
CC: Max Reitz <mreitz@redhat.com>
CC: Stefan Hajnoczi <stefanha@redhat.com>
CC: Fam Zheng <fam@euphon.net>
CC: Juan Quintela <quintela@redhat.com>
CC: Denis Plotnikov <dplotnikov@virtuozzo.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
migration/savevm.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/migration/savevm.c b/migration/savevm.c
index 6e01724605..45c9dd9d8a 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2635,7 +2635,7 @@ int save_snapshot(const char *name, Error **errp)
{
BlockDriverState *bs, *bs1;
QEMUSnapshotInfo sn1, *sn = &sn1, old_sn1, *old_sn = &old_sn1;
- int ret = -1;
+ int ret = -1, ret2;
QEMUFile *f;
int saved_vm_running;
uint64_t vm_state_size;
@@ -2719,10 +2719,14 @@ int save_snapshot(const char *name, Error **errp)
}
ret = qemu_savevm_state(f, errp);
vm_state_size = qemu_ftell(f);
- qemu_fclose(f);
+ ret2 = qemu_fclose(f);
if (ret < 0) {
goto the_end;
}
+ if (ret2 < 0) {
+ ret = ret2;
+ goto the_end;
+ }
/* The bdrv_all_create_snapshot() call that follows acquires the AioContext
* for itself. BDRV_POLL_WHILE() does not support nested locking because
--
2.25.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2 3/3] migration/migration.c: Remove superfluous breaks
2020-07-13 15:58 [PATCH v2 0/3] Migration Pull request Juan Quintela
2020-07-13 15:58 ` [PATCH v2 2/3] migration/savevm: respect qemu_fclose() error code in save_snapshot() Juan Quintela
@ 2020-07-13 15:58 ` Juan Quintela
1 sibling, 0 replies; 3+ messages in thread
From: Juan Quintela @ 2020-07-13 15:58 UTC (permalink / raw)
To: qemu-devel
Cc: Yi Wang, Thomas Huth, Juan Quintela, Philippe Mathieu-Daudé,
Dr. David Alan Gilbert, quintela, Liao Pingfang
From: Liao Pingfang <liao.pingfang@zte.com.cn>
Remove superfluous breaks, as there is a "return" before them.
Signed-off-by: Liao Pingfang <liao.pingfang@zte.com.cn>
Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
migration/migration.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index 08519de56f..2ed9923227 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -986,7 +986,6 @@ static void fill_source_migration_info(MigrationInfo *info)
/* no migration has happened ever */
/* do not overwrite destination migration status */
return;
- break;
case MIGRATION_STATUS_SETUP:
info->has_status = true;
info->has_total_time = false;
@@ -1105,7 +1104,6 @@ static void fill_destination_migration_info(MigrationInfo *info)
switch (mis->state) {
case MIGRATION_STATUS_NONE:
return;
- break;
case MIGRATION_STATUS_SETUP:
case MIGRATION_STATUS_CANCELLING:
case MIGRATION_STATUS_CANCELLED:
--
2.25.4
^ permalink raw reply related [flat|nested] 3+ messages in thread