From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35572) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSFuZ-0002vr-8K for qemu-devel@nongnu.org; Mon, 11 Jun 2018 02:02:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSFuY-0001xH-DY for qemu-devel@nongnu.org; Mon, 11 Jun 2018 02:02:39 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:51356 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fSFuY-0001x9-8x for qemu-devel@nongnu.org; Mon, 11 Jun 2018 02:02:38 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C850C401EF00 for ; Mon, 11 Jun 2018 06:02:37 +0000 (UTC) From: Peter Xu Date: Mon, 11 Jun 2018 14:02:28 +0800 Message-Id: <20180611060228.2998-3-peterx@redhat.com> In-Reply-To: <20180611060228.2998-1-peterx@redhat.com> References: <20180611060228.2998-1-peterx@redhat.com> Subject: [Qemu-devel] [PATCH 2/2] migration: delay postcopy paused state List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Juan Quintela , "Dr . David Alan Gilbert" , peterx@redhat.com Before this patch we firstly setup the postcopy-paused state then we clean up the QEMUFile handles. That can be racy if there is a very fast "migrate-recover" command running in parallel. Fix that up. Reported-by: Peter Maydell Signed-off-by: Peter Xu --- migration/savevm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index c2f34ffc7c..851d74e8b6 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2194,9 +2194,6 @@ static bool postcopy_pause_incoming(MigrationIncomingState *mis) /* Clear the triggered bit to allow one recovery */ mis->postcopy_recover_triggered = false; - migrate_set_state(&mis->state, MIGRATION_STATUS_POSTCOPY_ACTIVE, - MIGRATION_STATUS_POSTCOPY_PAUSED); - assert(mis->from_src_file); qemu_file_shutdown(mis->from_src_file); qemu_fclose(mis->from_src_file); @@ -2209,6 +2206,9 @@ static bool postcopy_pause_incoming(MigrationIncomingState *mis) mis->to_src_file = NULL; qemu_mutex_unlock(&mis->rp_mutex); + migrate_set_state(&mis->state, MIGRATION_STATUS_POSTCOPY_ACTIVE, + MIGRATION_STATUS_POSTCOPY_PAUSED); + /* Notify the fault thread for the invalidated file handle */ postcopy_fault_thread_notify(mis); -- 2.17.1