From patchwork Mon Jul 23 20:17:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 10540981 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 D590491E for ; Mon, 23 Jul 2018 21:04:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C6CE8284B3 for ; Mon, 23 Jul 2018 21:04:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB0D1284BE; Mon, 23 Jul 2018 21:04:01 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 609D7284B3 for ; Mon, 23 Jul 2018 21:04:01 +0000 (UTC) Received: from localhost ([::1]:36615 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhhzs-00071m-In for patchwork-qemu-devel@patchwork.kernel.org; Mon, 23 Jul 2018 17:04:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42379) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhhJu-0003Ad-JI for qemu-devel@nongnu.org; Mon, 23 Jul 2018 16:20:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fhhJt-0004rW-K1 for qemu-devel@nongnu.org; Mon, 23 Jul 2018 16:20:38 -0400 Received: from mail-oi0-x22f.google.com ([2607:f8b0:4003:c06::22f]:34563) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fhhJt-0004rI-Dv; Mon, 23 Jul 2018 16:20:37 -0400 Received: by mail-oi0-x22f.google.com with SMTP id 13-v6so3505790ois.1; Mon, 23 Jul 2018 13:20:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=5/hLiQrUtX4DP48kiLIpTEF5NgdxyUdRCA9tb0HzHH8=; b=ZZ19ESyFhxR94l7E34KKrwV/jLRNFd6zNHMnqcoHYfbF6Vg7i23Q0x2M9hmDFhyJJ9 RyM4szm93nuAnz1jynI4ZKge6IgMintRECjj9zYfNWOehGavW6PYqwYOn7ctqYaQvAri 52JobMj3+AAy9WjSdB5Ry7naQTWXO4+58UE/P2Kjh78JXq/HwSF9tpNiSdZrIFWzZGrP zURr4ecGHPFuSShpT1bJTds3dkSv6i4dUr+pqu6hJyFAJhehxX8z60l1gas0ujJ6EKQV iyKQIgXYIQnsGez9pWlHDN0dSio//fJYGEgCYd+uIUiQ4AHqcE7BhxGtSyFtskE11keL /7Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=5/hLiQrUtX4DP48kiLIpTEF5NgdxyUdRCA9tb0HzHH8=; b=ovF48TH/IizulB+2LghvtzGENImdLzEUxivHspvxAgYlk5Nx60jOfHo78mb3YIJr22 YUFnxO0GjcsEd4nw2bmA+lcnNXpztIYgBhffsUwbSgmt99ZDCF8xMwF87vEWWzOJfvum dh7XfGaIei0ekfWljm/nMTp0bNH2K9UUJQT+Edx7rxLWiNZnijBiD5selAEzmbbO2bBX v965NIi+iiJJMMFhWGHqYText3A732NaqjJhYHGiTXLQl/ogK27uLP3M+FigsW/Qo8Q5 Uo0dBVNpJH6FR79FyUM+eQRPR/wwMD6+VCZp7ah0sxForv/Ooy/S7fhGucbqcw/TIqDR /gvQ== X-Gm-Message-State: AOUpUlGduliZ4htpK+mWh6bigj/71cSgQ5zhSUVs12wMV5WNUQU4OwkZ 362GqxN2lBUl//I6Zk+aP9UY2W+a2789mg== X-Google-Smtp-Source: AAOMgpeXdGV2MryByXaAKAAYJLqrxmDCfDHXyz6CwIQlYVp7VzTA5tXcT/j1goLxQuvaakh2bA/pcg== X-Received: by 2002:aca:305:: with SMTP id 5-v6mr340255oid.84.1532377236295; Mon, 23 Jul 2018 13:20:36 -0700 (PDT) Received: from localhost (76-251-165-188.lightspeed.austtx.sbcglobal.net. [76.251.165.188]) by smtp.gmail.com with ESMTPSA id r81-v6sm14555505oih.28.2018.07.23.13.20.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jul 2018 13:20:35 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 23 Jul 2018 15:17:07 -0500 Message-Id: <20180723201748.25573-59-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180723201748.25573-1-mdroth@linux.vnet.ibm.com> References: <20180723201748.25573-1-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::22f Subject: [Qemu-devel] [PATCH 58/99] 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: Jeff Cody , qemu-stable@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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=1572856 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 (cherry picked from commit eb36639f7bbc16055e551593b81365e8ae3b0b05) Signed-off-by: Michael Roth --- 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 = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);