Message ID | 20181101101715.9443-8-fli@suse.com |
---|---|
State | New |
Headers | show |
Series | qemu_thread_create: propagate errors to callers to check | expand |
Fei Li <fli@suse.com> wrote: > Always call migrate_set_error() to set the error state without relying > on whether multifd_save_cleanup() succeeds. As the passed &local_err > is never used in multifd_save_cleanup(), remove it. Error is not used, you are right. But then just change the prototype to: void multifd_save_cleanup(void); ?? With that change, Reviewed-by: Juan Quintela <quintela@redhat.com>
On 11/05/2018 09:59 PM, Juan Quintela wrote: > Fei Li <fli@suse.com> wrote: >> Always call migrate_set_error() to set the error state without relying >> on whether multifd_save_cleanup() succeeds. As the passed &local_err >> is never used in multifd_save_cleanup(), remove it. > Error is not used, you are right. > > But then just change the prototype to: > > void multifd_save_cleanup(void); > > ?? > > With that change, > > Reviewed-by: Juan Quintela <quintela@redhat.com> Thanks for the review! Have changed that function to be void, besides, correct the previous erroneous function name in the patch title: s/migratr_set_error/multifd_save_cleanup/g.
diff --git a/migration/migration.c b/migration/migration.c index 87dfc7374f..3b8b7ab4f9 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1377,7 +1377,6 @@ static void migrate_fd_cleanup(void *opaque) qemu_savevm_state_cleanup(); if (s->to_dst_file) { - Error *local_err = NULL; QEMUFile *tmp; trace_migrate_fd_cleanup(); @@ -1388,9 +1387,7 @@ static void migrate_fd_cleanup(void *opaque) } qemu_mutex_lock_iothread(); - if (multifd_save_cleanup(&local_err) != 0) { - error_report_err(local_err); - } + multifd_save_cleanup(); qemu_mutex_lock(&s->qemu_file_lock); tmp = s->to_dst_file; s->to_dst_file = NULL; diff --git a/migration/ram.c b/migration/ram.c index 5008a9ab02..cea255d9b9 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -922,7 +922,7 @@ static void multifd_send_terminate_threads(Error *err) } } -int multifd_save_cleanup(Error **errp) +int multifd_save_cleanup(void) { int i; int ret = 0; @@ -1081,10 +1081,9 @@ static void multifd_new_send_channel_async(QIOTask *task, gpointer opaque) } if (qio_task_propagate_error(task, &local_err)) { - if (multifd_save_cleanup(&local_err) != 0) { - migrate_set_error(migrate_get_current(), local_err); - } + migrate_set_error(migrate_get_current(), local_err); migrate_set_state(&s->state, s->state, MIGRATION_STATUS_FAILED); + multifd_save_cleanup(); } else { p->c = QIO_CHANNEL(sioc); qio_channel_set_delay(p->c, false); diff --git a/migration/ram.h b/migration/ram.h index 046d3074be..0d1215209e 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -43,7 +43,7 @@ uint64_t ram_bytes_remaining(void); uint64_t ram_bytes_total(void); int multifd_save_setup(void); -int multifd_save_cleanup(Error **errp); +int multifd_save_cleanup(void); int multifd_load_setup(void); int multifd_load_cleanup(Error **errp); bool multifd_recv_all_channels_created(void);
Always call migrate_set_error() to set the error state without relying on whether multifd_save_cleanup() succeeds. As the passed &local_err is never used in multifd_save_cleanup(), remove it. Cc: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Fei Li <fli@suse.com> --- migration/migration.c | 5 +---- migration/ram.c | 7 +++---- migration/ram.h | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-)