]> git.proxmox.com Git - mirror_qemu.git/commitdiff
blockjob: Fix assertion in block_job_finalize()
authorKevin Wolf <kwolf@redhat.com>
Tue, 8 May 2018 09:55:30 +0000 (11:55 +0200)
committerKevin Wolf <kwolf@redhat.com>
Tue, 15 May 2018 14:11:49 +0000 (16:11 +0200)
Every job gets a non-NULL job->txn on creation, but it doesn't
necessarily keep it until it is decommissioned: Finalising a job removes
it from its transaction. Therefore, calling 'blockdev-job-finalize' a
second time on an already concluded job causes an assertion failure.

Remove job->txn from the assertion in block_job_finalize() to fix this.
block_job_do_finalize() still has the same assertion, but if a job is
already removed from its transaction, block_job_apply_verb() will
already error out before we run into that assertion.

Cc: qemu-stable@nongnu.org
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
blockjob.c

index 0b9b336d1928f07ad2d222c031a42359008264cf..0ebc5ab1789eade0d4298a62710962f656180585 100644 (file)
@@ -702,7 +702,7 @@ void block_job_complete(BlockJob *job, Error **errp)
 
 void block_job_finalize(BlockJob *job, Error **errp)
 {
-    assert(job && job->id && job->txn);
+    assert(job && job->id);
     if (block_job_apply_verb(job, BLOCK_JOB_VERB_FINALIZE, errp)) {
         return;
     }