Skip to content

Commit

Permalink
migration: Do not call PRECOPY_NOTIFY_SETUP notifiers in case of error
Browse files Browse the repository at this point in the history
When commit bd22706 ("migration/ram.c: add a notifier chain for
precopy") added PRECOPY_NOTIFY_SETUP notifiers at the end of
qemu_savevm_state_setup(), it didn't take into account a possible
error in the loop calling vmstate_save() or .save_setup() handlers.

Check ret value before calling the notifiers.

Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/r/20240304122844.1888308-10-clg@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com>
  • Loading branch information
legoater authored and xzpeter committed Mar 11, 2024
1 parent ee8bb86 commit e6e08e8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion migration/savevm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1317,7 +1317,7 @@ void qemu_savevm_state_setup(QEMUFile *f)
MigrationState *ms = migrate_get_current();
SaveStateEntry *se;
Error *local_err = NULL;
int ret;
int ret = 0;

json_writer_int64(ms->vmdesc, "page_size", qemu_target_page_size());
json_writer_start_array(ms->vmdesc, "devices");
Expand Down Expand Up @@ -1351,6 +1351,10 @@ void qemu_savevm_state_setup(QEMUFile *f)
}
}

if (ret) {
return;
}

if (precopy_notify(PRECOPY_NOTIFY_SETUP, &local_err)) {
error_report_err(local_err);
}
Expand Down

0 comments on commit e6e08e8

Please sign in to comment.