Blame SOURCES/kvm-blockjob-Fix-assertion-in-block_job_finalize.patch

1bdc94
From 7c3744d3960176798cde84b989bab4f7955f97c3 Mon Sep 17 00:00:00 2001
1bdc94
From: Kevin Wolf <kwolf@redhat.com>
1bdc94
Date: Tue, 26 Jun 2018 09:47:51 +0200
1bdc94
Subject: [PATCH 22/89] blockjob: Fix assertion in block_job_finalize()
1bdc94
1bdc94
RH-Author: Kevin Wolf <kwolf@redhat.com>
1bdc94
Message-id: <20180626094856.6924-9-kwolf@redhat.com>
1bdc94
Patchwork-id: 81060
1bdc94
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH v2 08/73] blockjob: Fix assertion in block_job_finalize()
1bdc94
Bugzilla: 1513543
1bdc94
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
1bdc94
RH-Acked-by: Max Reitz <mreitz@redhat.com>
1bdc94
RH-Acked-by: Fam Zheng <famz@redhat.com>
1bdc94
1bdc94
Every job gets a non-NULL job->txn on creation, but it doesn't
1bdc94
necessarily keep it until it is decommissioned: Finalising a job removes
1bdc94
it from its transaction. Therefore, calling 'blockdev-job-finalize' a
1bdc94
second time on an already concluded job causes an assertion failure.
1bdc94
1bdc94
Remove job->txn from the assertion in block_job_finalize() to fix this.
1bdc94
block_job_do_finalize() still has the same assertion, but if a job is
1bdc94
already removed from its transaction, block_job_apply_verb() will
1bdc94
already error out before we run into that assertion.
1bdc94
1bdc94
Cc: qemu-stable@nongnu.org
1bdc94
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
1bdc94
Reviewed-by: Eric Blake <eblake@redhat.com>
1bdc94
Reviewed-by: Max Reitz <mreitz@redhat.com>
1bdc94
Reviewed-by: John Snow <jsnow@redhat.com>
1bdc94
(cherry picked from commit 37aa19b63c46d933f1e4ea944cfccee54e2caf4a)
1bdc94
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
1bdc94
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
1bdc94
---
1bdc94
 blockjob.c | 2 +-
1bdc94
 1 file changed, 1 insertion(+), 1 deletion(-)
1bdc94
1bdc94
diff --git a/blockjob.c b/blockjob.c
1bdc94
index 6746cad..0033b96 100644
1bdc94
--- a/blockjob.c
1bdc94
+++ b/blockjob.c
1bdc94
@@ -710,7 +710,7 @@ void block_job_complete(BlockJob *job, Error **errp)
1bdc94
 
1bdc94
 void block_job_finalize(BlockJob *job, Error **errp)
1bdc94
 {
1bdc94
-    assert(job && job->id && job->txn);
1bdc94
+    assert(job && job->id);
1bdc94
     if (block_job_apply_verb(job, BLOCK_JOB_VERB_FINALIZE, errp)) {
1bdc94
         return;
1bdc94
     }
1bdc94
-- 
1bdc94
1.8.3.1
1bdc94