From patchwork Fri Jun 14 09:28:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Chen X-Patchwork-Id: 10994811 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 405461398 for ; Fri, 14 Jun 2019 09:39:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 30774212DB for ; Fri, 14 Jun 2019 09:39:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 24A33277D9; Fri, 14 Jun 2019 09:39:06 +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=-2.3 required=2.0 tests=BAYES_00,FROM_ADDR_WS, FROM_WSP_TRAIL,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 39CAC212DB for ; Fri, 14 Jun 2019 09:39:04 +0000 (UTC) Received: from localhost ([::1]:49606 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbifn-0006QE-7v for patchwork-qemu-devel@patchwork.kernel.org; Fri, 14 Jun 2019 05:39:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40698) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbieD-0004hV-K0 for qemu-devel@nongnu.org; Fri, 14 Jun 2019 05:37:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbiac-0001TN-UW for qemu-devel@nongnu.org; Fri, 14 Jun 2019 05:33:44 -0400 Received: from mga17.intel.com ([192.55.52.151]:19769) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hbiab-0001MY-2u; Fri, 14 Jun 2019 05:33:41 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Jun 2019 02:33:32 -0700 X-ExtLoop1: 1 Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by fmsmga008.fm.intel.com with ESMTP; 14 Jun 2019 02:33:31 -0700 From: Zhang Chen To: Xie Changlong , Kevin Wolf , Max Reitz , qemu-block , qemu-dev Date: Fri, 14 Jun 2019 17:28:53 +0800 Message-Id: <20190614092853.26551-1-chen.zhang@intel.com> X-Mailer: git-send-email 2.17.GIT X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 192.55.52.151 Subject: [Qemu-devel] [PATCH] block/replication.c: Fix crash issue after failover X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Zhang Chen , Zhang Chen Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Zhang Chen No block job on active disk after failover. In the replication_stop() function have canceled the block job, we check it again here. Signed-off-by: Zhang Chen --- block/replication.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/block/replication.c b/block/replication.c index 3d4dedddfc..bdf2bf4bbc 100644 --- a/block/replication.c +++ b/block/replication.c @@ -146,7 +146,9 @@ static void replication_close(BlockDriverState *bs) replication_stop(s->rs, false, NULL); } if (s->stage == BLOCK_REPLICATION_FAILOVER) { - job_cancel_sync(&s->active_disk->bs->job->job); + if (s->secondary_disk->bs->job) { + job_cancel_sync(&s->secondary_disk->bs->job->job); + } } if (s->mode == REPLICATION_MODE_SECONDARY) {