[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 04/25] migration: Do not call PRECOPY_NOTIFY_SETUP notifiers i
From: |
Cédric Le Goater |
Subject: |
[PATCH v4 04/25] migration: Do not call PRECOPY_NOTIFY_SETUP notifiers in case of error |
Date: |
Wed, 6 Mar 2024 14:34:19 +0100 |
When commit bd2270608fa0 ("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>
---
migration/savevm.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/migration/savevm.c b/migration/savevm.c
index
dc1fb9c0d32bbf037471b810bd28e9361c2d7b87..63066f49f3ad5504be6d44ffdf9f7b759c0a25ef
100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -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");
@@ -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);
}
--
2.44.0
- [PATCH v4 00/25] migration: Improve error reporting, Cédric Le Goater, 2024/03/06
- [PATCH v4 02/25] migration: Remove SaveStateHandler and LoadStateHandler typedefs, Cédric Le Goater, 2024/03/06
- [PATCH v4 01/25] migration: Report error when shutdown fails, Cédric Le Goater, 2024/03/06
- [PATCH v4 03/25] migration: Add documentation for SaveVMHandlers, Cédric Le Goater, 2024/03/06
- [PATCH v4 04/25] migration: Do not call PRECOPY_NOTIFY_SETUP notifiers in case of error,
Cédric Le Goater <=
- [PATCH v4 05/25] s390/stattrib: Add Error** argument to set_migrationmode() handler, Cédric Le Goater, 2024/03/06
- [PATCH v4 07/25] migration: Always report an error in block_save_setup(), Cédric Le Goater, 2024/03/06
- [PATCH v4 09/25] migration: Add Error** argument to vmstate_save(), Cédric Le Goater, 2024/03/06
- [PATCH v4 10/25] migration: Add Error** argument to qemu_savevm_state_setup(), Cédric Le Goater, 2024/03/06