migration: Stop migration immediately in RDMA error paths
In multiple places, RDMA errors are handled in a strange way, where it only sets qemu_file_set_error() but not stop the migration immediately. It's not obvious what will happen later if there is already an error. Make all such failures stop migration immediately. Cc: Zhijian Li (Fujitsu) <lizhijian@fujitsu.com> Cc: Markus Armbruster <armbru@redhat.com> Cc: Juan Quintela <quintela@redhat.com> Cc: Fabiano Rosas <farosas@suse.de> Reported-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Peter Xu <peterx@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Fabiano Rosas <farosas@suse.de> Signed-off-by: Juan Quintela <quintela@redhat.com> Message-ID: <20231024163933.516546-1-peterx@redhat.com>
This commit is contained in:
parent
864128df46
commit
a2326705e5
@ -2973,11 +2973,13 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
|
|||||||
ret = rdma_registration_start(f, RAM_CONTROL_SETUP);
|
ret = rdma_registration_start(f, RAM_CONTROL_SETUP);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
qemu_file_set_error(f, ret);
|
qemu_file_set_error(f, ret);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = rdma_registration_stop(f, RAM_CONTROL_SETUP);
|
ret = rdma_registration_stop(f, RAM_CONTROL_SETUP);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
qemu_file_set_error(f, ret);
|
qemu_file_set_error(f, ret);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
migration_ops = g_malloc0(sizeof(MigrationOps));
|
migration_ops = g_malloc0(sizeof(MigrationOps));
|
||||||
@ -3043,6 +3045,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
|
|||||||
ret = rdma_registration_start(f, RAM_CONTROL_ROUND);
|
ret = rdma_registration_start(f, RAM_CONTROL_ROUND);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
qemu_file_set_error(f, ret);
|
qemu_file_set_error(f, ret);
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
t0 = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
|
t0 = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
|
||||||
@ -3147,8 +3150,6 @@ static int ram_save_complete(QEMUFile *f, void *opaque)
|
|||||||
rs->last_stage = !migration_in_colo_state();
|
rs->last_stage = !migration_in_colo_state();
|
||||||
|
|
||||||
WITH_RCU_READ_LOCK_GUARD() {
|
WITH_RCU_READ_LOCK_GUARD() {
|
||||||
int rdma_reg_ret;
|
|
||||||
|
|
||||||
if (!migration_in_postcopy()) {
|
if (!migration_in_postcopy()) {
|
||||||
migration_bitmap_sync_precopy(rs, true);
|
migration_bitmap_sync_precopy(rs, true);
|
||||||
}
|
}
|
||||||
@ -3156,6 +3157,7 @@ static int ram_save_complete(QEMUFile *f, void *opaque)
|
|||||||
ret = rdma_registration_start(f, RAM_CONTROL_FINISH);
|
ret = rdma_registration_start(f, RAM_CONTROL_FINISH);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
qemu_file_set_error(f, ret);
|
qemu_file_set_error(f, ret);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* try transferring iterative blocks of memory */
|
/* try transferring iterative blocks of memory */
|
||||||
@ -3171,23 +3173,20 @@ static int ram_save_complete(QEMUFile *f, void *opaque)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (pages < 0) {
|
if (pages < 0) {
|
||||||
ret = pages;
|
qemu_mutex_unlock(&rs->bitmap_mutex);
|
||||||
break;
|
return pages;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qemu_mutex_unlock(&rs->bitmap_mutex);
|
qemu_mutex_unlock(&rs->bitmap_mutex);
|
||||||
|
|
||||||
compress_flush_data();
|
compress_flush_data();
|
||||||
|
|
||||||
rdma_reg_ret = rdma_registration_stop(f, RAM_CONTROL_FINISH);
|
ret = rdma_registration_stop(f, RAM_CONTROL_FINISH);
|
||||||
if (rdma_reg_ret < 0) {
|
|
||||||
qemu_file_set_error(f, rdma_reg_ret);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
qemu_file_set_error(f, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ret = multifd_send_sync_main(rs->pss[RAM_CHANNEL_PRECOPY].pss_channel);
|
ret = multifd_send_sync_main(rs->pss[RAM_CHANNEL_PRECOPY].pss_channel);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user