Blame SOURCES/kvm-block-mirror-Make-cancel-always-cancel-pre-READY.patch

ae23c9
From a31ab535355600b06654345542f388d855c4569c Mon Sep 17 00:00:00 2001
ae23c9
From: Max Reitz <mreitz@redhat.com>
ae23c9
Date: Mon, 18 Jun 2018 14:47:35 +0200
ae23c9
Subject: [PATCH 034/268] block/mirror: Make cancel always cancel pre-READY
ae23c9
ae23c9
RH-Author: Max Reitz <mreitz@redhat.com>
ae23c9
Message-id: <20180618144736.29873-3-mreitz@redhat.com>
ae23c9
Patchwork-id: 80748
ae23c9
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH 2/3] block/mirror: Make cancel always cancel pre-READY
ae23c9
Bugzilla: 1572856
ae23c9
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
ae23c9
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
ae23c9
RH-Acked-by: John Snow <jsnow@redhat.com>
ae23c9
ae23c9
Commit b76e4458b1eb3c32e9824fe6aa51f67d2b251748 made the mirror block
ae23c9
job respect block-job-cancel's @force flag: With that flag set, it would
ae23c9
now always really cancel, even post-READY.
ae23c9
ae23c9
Unfortunately, it had a side effect: Without that flag set, it would now
ae23c9
never cancel, not even before READY.  Considering that is an
ae23c9
incompatible change and not noted anywhere in the commit or the
ae23c9
description of block-job-cancel's @force parameter, this seems
ae23c9
unintentional and we should revert to the previous behavior, which is to
ae23c9
immediately cancel the job when block-job-cancel is called before source
ae23c9
and target are in sync (i.e. before the READY event).
ae23c9
ae23c9
Cc: qemu-stable@nongnu.org
ae23c9
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1572856
ae23c9
Reported-by: Yanan Fu <yfu@redhat.com>
ae23c9
Signed-off-by: Max Reitz <mreitz@redhat.com>
ae23c9
Reviewed-by: Eric Blake <eblake@redhat.com>
ae23c9
Message-id: 20180501220509.14152-2-mreitz@redhat.com
ae23c9
Reviewed-by: Jeff Cody <jcody@redhat.com>
ae23c9
Signed-off-by: Jeff Cody <jcody@redhat.com>
ae23c9
(cherry picked from commit eb36639f7bbc16055e551593b81365e8ae3b0b05)
ae23c9
Signed-off-by: Max Reitz <mreitz@redhat.com>
ae23c9
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
ae23c9
---
ae23c9
 block/mirror.c | 4 +++-
ae23c9
 1 file changed, 3 insertions(+), 1 deletion(-)
ae23c9
ae23c9
diff --git a/block/mirror.c b/block/mirror.c
ae23c9
index 9436a8d..99da9c0 100644
ae23c9
--- a/block/mirror.c
ae23c9
+++ b/block/mirror.c
ae23c9
@@ -874,7 +874,9 @@ static void coroutine_fn mirror_run(void *opaque)
ae23c9
         }
ae23c9
         trace_mirror_before_sleep(s, cnt, s->synced, delay_ns);
ae23c9
         block_job_sleep_ns(&s->common, delay_ns);
ae23c9
-        if (block_job_is_cancelled(&s->common) && s->common.force) {
ae23c9
+        if (block_job_is_cancelled(&s->common) &&
ae23c9
+            (!s->synced || s->common.force))
ae23c9
+        {
ae23c9
             break;
ae23c9
         }
ae23c9
         s->last_pause_ns = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9