From nobody Thu Dec 18 13:19:39 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1525793488197159.50086342388795; Tue, 8 May 2018 08:31:28 -0700 (PDT) Received: from localhost ([::1]:51918 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fG4aN-0004QQ-60 for importer@patchew.org; Tue, 08 May 2018 11:31:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33337) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fG4PJ-00029y-2D for qemu-devel@nongnu.org; Tue, 08 May 2018 11:20:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fG4PI-0004ZJ-0w for qemu-devel@nongnu.org; Tue, 08 May 2018 11:20:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1887) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fG4PE-0004VY-Er; Tue, 08 May 2018 11:19:56 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 95C023003A3B; Tue, 8 May 2018 15:19:55 +0000 (UTC) Received: from localhost (ovpn-117-144.phx2.redhat.com [10.3.117.144]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 63A7D5D70C; Tue, 8 May 2018 15:19:55 +0000 (UTC) From: Jeff Cody To: qemu-block@nongnu.org Date: Tue, 8 May 2018 11:19:22 -0400 Message-Id: <20180508151924.18741-3-jcody@redhat.com> In-Reply-To: <20180508151924.18741-1-jcody@redhat.com> References: <20180508151924.18741-1-jcody@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 08 May 2018 15:19:55 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 2/4] block/mirror: Make cancel always cancel pre-READY 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: Kevin Wolf , peter.maydell@linaro.org, sheepdog@lists.wpkg.org, Hitoshi Mitake , Jeff Cody , qemu-devel@nongnu.org, Max Reitz , Liu Yuan , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Max Reitz Commit b76e4458b1eb3c32e9824fe6aa51f67d2b251748 made the mirror block job respect block-job-cancel's @force flag: With that flag set, it would now always really cancel, even post-READY. Unfortunately, it had a side effect: Without that flag set, it would now never cancel, not even before READY. Considering that is an incompatible change and not noted anywhere in the commit or the description of block-job-cancel's @force parameter, this seems unintentional and we should revert to the previous behavior, which is to immediately cancel the job when block-job-cancel is called before source and target are in sync (i.e. before the READY event). Cc: qemu-stable@nongnu.org Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=3D1572856 Reported-by: Yanan Fu Signed-off-by: Max Reitz Reviewed-by: Eric Blake Message-id: 20180501220509.14152-2-mreitz@redhat.com Reviewed-by: Jeff Cody Signed-off-by: Jeff Cody --- block/mirror.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/block/mirror.c b/block/mirror.c index 9436a8d5ee..99da9c0858 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -874,7 +874,9 @@ static void coroutine_fn mirror_run(void *opaque) } trace_mirror_before_sleep(s, cnt, s->synced, delay_ns); block_job_sleep_ns(&s->common, delay_ns); - if (block_job_is_cancelled(&s->common) && s->common.force) { + if (block_job_is_cancelled(&s->common) && + (!s->synced || s->common.force)) + { break; } s->last_pause_ns =3D qemu_clock_get_ns(QEMU_CLOCK_REALTIME); --=20 2.13.6