From patchwork Sat Nov 19 11:43:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhanghailiang X-Patchwork-Id: 9438115 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 031966047D for ; Sat, 19 Nov 2016 11:44:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D202B2974D for ; Sat, 19 Nov 2016 11:44:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C32AC29752; Sat, 19 Nov 2016 11:44:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1F2DF2974D for ; Sat, 19 Nov 2016 11:44:47 +0000 (UTC) Received: from localhost ([::1]:41008 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c844c-0005nF-NX for patchwork-qemu-devel@patchwork.kernel.org; Sat, 19 Nov 2016 06:44:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40494) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c844M-0005n9-CM for qemu-devel@nongnu.org; Sat, 19 Nov 2016 06:44:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c844J-0002jl-BQ for qemu-devel@nongnu.org; Sat, 19 Nov 2016 06:44:30 -0500 Received: from szxga01-in.huawei.com ([58.251.152.64]:55861) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1c844H-0002c5-9Y for qemu-devel@nongnu.org; Sat, 19 Nov 2016 06:44:27 -0500 Received: from 172.24.1.136 (EHLO SZXEML424-HUB.china.huawei.com) ([172.24.1.136]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DVJ24939; Sat, 19 Nov 2016 19:44:09 +0800 (CST) Received: from localhost (10.177.24.212) by SZXEML424-HUB.china.huawei.com (10.82.67.153) with Microsoft SMTP Server id 14.3.235.1; Sat, 19 Nov 2016 19:43:58 +0800 From: zhanghailiang To: , Date: Sat, 19 Nov 2016 19:43:51 +0800 Message-ID: <1479555831-30960-1-git-send-email-zhang.zhanghailiang@huawei.com> X-Mailer: git-send-email 2.7.2.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.177.24.212] X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy] X-Received-From: 58.251.152.64 Subject: [Qemu-devel] [PATCH] migration: re-active images when migration fails to complete X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, zhanghailiang Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP commit fe904ea8242cbae2d7e69c052c754b8f5f1ba1d6 fixed a case which migration aborted QEMU because it didn't regain the control of images while some errors happened. Actually, we have another case in that error path to abort QEMU because of the same reason: migration_thread() migration_completion() bdrv_inactivate_all() ----------------> inactivate images qemu_savevm_state_complete_precopy() socket_writev_buffer() --------> error because destination fails qemu_fflush() -------------------> set error on migration stream qemu_mutex_unlock_iothread() ------> unlock qmp_migrate_cancel() ---------------------> user cancelled migration migrate_set_state() ------------------> set migrate CANCELLING migration_completion() -----------------> go on to fail_invalidate if (s->state == MIGRATION_STATUS_ACTIVE) -> Jump this branch migration_thread() -----------------------> break migration loop vm_start() -----------------------------> restart guest with inactive images We failed to regain the control of images because we only regain it while the migration state is "active", but here users cancelled the migration when they found some errors happened (for example, libvirtd daemon is shutdown in destination unexpectedly). Signed-off-by: zhanghailiang --- migration/migration.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index f498ab8..0c1ee6d 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1752,7 +1752,8 @@ fail_invalidate: /* If not doing postcopy, vm_start() will be called: let's regain * control on images. */ - if (s->state == MIGRATION_STATUS_ACTIVE) { + if (s->state == MIGRATION_STATUS_ACTIVE || + s->state == MIGRATION_STATUS_CANCELLING) { Error *local_err = NULL; bdrv_invalidate_cache_all(&local_err);