From b3ca1d90e916563b7493be6d1a093bc161d23ddb Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Thu, 3 Feb 2022 10:43:11 +0100 Subject: [PATCH] vmm: Stop dirty logging only if it has been started Now that we introduced a separate method to indicate when the migration is started, both start_dirty_log() and stop_dirty_log() don't have to carry an implicit meaning as they can focus entirely on the dirty log being started or stopped. For that reason, we can now safely move stop_dirty_log() to the code section performing non-local migration. It makes only sense to stop logging dirty pages if this has been started before. Signed-off-by: Sebastien Boeuf --- vmm/src/lib.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/vmm/src/lib.rs b/vmm/src/lib.rs index 0de2249cc..4dae86554 100644 --- a/vmm/src/lib.rs +++ b/vmm/src/lib.rs @@ -1142,6 +1142,9 @@ impl Vmm { // Send last batch of dirty pages Self::vm_maybe_send_dirty_pages(vm, &mut socket)?; + + // Stop logging dirty pages + vm.stop_dirty_log()?; } // Capture snapshot and send it let vm_snapshot = vm.snapshot()?; @@ -1174,12 +1177,7 @@ impl Vmm { info!("Migration complete"); // Let every Migratable object know about the migration being complete - vm.complete_migration()?; - - // Stop logging dirty pages - vm.stop_dirty_log()?; - - Ok(()) + vm.complete_migration() } fn vm_send_migration(