From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40737) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcuaw-00035i-Ui for qemu-devel@nongnu.org; Tue, 10 Jul 2018 11:30:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcuas-0003GP-9Z for qemu-devel@nongnu.org; Tue, 10 Jul 2018 11:30:26 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:45232 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 1fcuar-0003G1-Ou for qemu-devel@nongnu.org; Tue, 10 Jul 2018 11:30:22 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 600B677889 for ; Tue, 10 Jul 2018 15:30:21 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" Date: Tue, 10 Jul 2018 16:30:02 +0100 Message-Id: <20180710153016.131258-2-dgilbert@redhat.com> In-Reply-To: <20180710153016.131258-1-dgilbert@redhat.com> References: <20180710153016.131258-1-dgilbert@redhat.com> Subject: [Qemu-devel] [PULL 01/15] migration: delay postcopy paused state List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, peterx@redhat.com, quintela@redhat.com From: Peter Xu 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 Reviewed-by: Juan Quintela Signed-off-by: Peter Xu Message-Id: <20180627132246.5576-2-peterx@redhat.com> Signed-off-by: Dr. David Alan Gilbert --- 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