From nobody Sun May 5 08:50:51 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1560505180; cv=none; d=zoho.com; s=zohoarc; b=R6uRZjNYvwM4B1ZMlwR8kuwHnb2K8qNgDXnJ7n5mIlQXbhc8ihmIoclGJCKSWNPpILeQxSt7FmwQaLRwSFjW0wGg1FkU+XvFSg5JDW4H9r2ToF7AeuABSx7qHIonGqpoNJ4k4zsc8On6JwV+KlUKcRzvaSeLW/KdMgS2kCCLgs4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560505180; h=Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=JIxjtZf++Kd6mZvCz7bsefhBXsSHvpTkSw0l7yKnncg=; b=BvNsR/8CVPEn4FneD0ygnDMcLFaVii1furV1EieMrdy3VtxqBTETwYBR+Zrj4VN/YYz1b0viUm65kNOmFU1kH7kWDfuJYLxFUR9SNCOYhH2O4CQhSFTrdp9rHe+dp2vj2LF8HfK4zrT0LLK//VrYNHm21gKTbfcpRNQ+bshJyrU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560505180167294.7780010694945; Fri, 14 Jun 2019 02:39:40 -0700 (PDT) Received: from localhost ([::1]:49606 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbigM-0006QE-Sq for importer@patchew.org; Fri, 14 Jun 2019 05:39:38 -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 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 Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by fmsmga008.fm.intel.com with ESMTP; 14 Jun 2019 02:33:31 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 =3D=3D 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); + } } =20 if (s->mode =3D=3D REPLICATION_MODE_SECONDARY) { --=20 2.17.GIT