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

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