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