yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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