Skip to content

Commit 7d6f693

Browse files
author
Markus Armbruster
committed
migration: Handle migration_incoming_setup() errors consistently
Commit b673eab "multifd: Make multifd_load_setup() get an Error parameter" changed migration_incoming_setup() to take an Error ** argument, and adjusted the callers accordingly. It neglected to change adjust multifd_load_setup(): it still exit()s on error. Clean that up. The error now gets propagated up two call chains: via migration_fd_process_incoming() to rdma_accept_incoming_migration(), and via migration_ioc_process_incoming() to migration_channel_process_incoming(). Both chain ends report the error with error_report_err(), but otherwise ignore it. Behavioral change: we no longer exit() on this error. This is consistent with how we handle other errors here, e.g. from multifd_recv_new_channel() via migration_ioc_process_incoming() to migration_channel_process_incoming(). Whether it's consistently right or consistently wrong I can't tell. Also clean up the return value from the unusual 0 on success, 1 on error to the more common true on success, false on error. Cc: Juan Quintela <[email protected]> Cc: Dr. David Alan Gilbert <[email protected]> Signed-off-by: Markus Armbruster <[email protected]> Message-Id: <[email protected]> Reviewed-by: Eric Blake <[email protected]> Reviewed-by: Pankaj Gupta <[email protected]> Acked-by: Michael S. Tsirkin <[email protected]>
1 parent 436c831 commit 7d6f693

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

migration/migration.c

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -611,30 +611,25 @@ static void process_incoming_migration_co(void *opaque)
611611
}
612612

613613
/**
614-
* @migration_incoming_setup: Setup incoming migration
615-
*
616-
* Returns 0 for no error or 1 for error
617-
*
614+
* migration_incoming_setup: Setup incoming migration
618615
* @f: file for main migration channel
619616
* @errp: where to put errors
617+
*
618+
* Returns: %true on success, %false on error.
620619
*/
621-
static int migration_incoming_setup(QEMUFile *f, Error **errp)
620+
static bool migration_incoming_setup(QEMUFile *f, Error **errp)
622621
{
623622
MigrationIncomingState *mis = migration_incoming_get_current();
624-
Error *local_err = NULL;
625623

626-
if (multifd_load_setup(&local_err) != 0) {
627-
/* We haven't been able to create multifd threads
628-
nothing better to do */
629-
error_report_err(local_err);
630-
exit(EXIT_FAILURE);
624+
if (multifd_load_setup(errp) != 0) {
625+
return false;
631626
}
632627

633628
if (!mis->from_src_file) {
634629
mis->from_src_file = f;
635630
}
636631
qemu_file_set_blocking(f, false);
637-
return 0;
632+
return true;
638633
}
639634

640635
void migration_incoming_process(void)
@@ -677,14 +672,11 @@ static bool postcopy_try_recover(QEMUFile *f)
677672

678673
void migration_fd_process_incoming(QEMUFile *f, Error **errp)
679674
{
680-
Error *local_err = NULL;
681-
682675
if (postcopy_try_recover(f)) {
683676
return;
684677
}
685678

686-
if (migration_incoming_setup(f, &local_err)) {
687-
error_propagate(errp, local_err);
679+
if (!migration_incoming_setup(f, errp)) {
688680
return;
689681
}
690682
migration_incoming_process();
@@ -705,8 +697,7 @@ void migration_ioc_process_incoming(QIOChannel *ioc, Error **errp)
705697
return;
706698
}
707699

708-
if (migration_incoming_setup(f, &local_err)) {
709-
error_propagate(errp, local_err);
700+
if (!migration_incoming_setup(f, errp)) {
710701
return;
711702
}
712703

0 commit comments

Comments
 (0)