提交 1dd3ba38 编写于 作者: K Kevin Wolf 提交者: Michael Roth

commit: Fix completion with extra reference

commit_complete() can't assume that after its block_job_completed() the
job is actually immediately freed; someone else may still be holding
references. In this case, the op blockers on the intermediate nodes make
the graph reconfiguration in the completion code fail.

Call block_job_remove_all_bdrv() manually so that we know for sure that
any blockers on intermediate nodes are given up.

Cc: qemu-stable@nongnu.org
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
Reviewed-by: NMax Reitz <mreitz@redhat.com>
(cherry picked from commit 4f78a16f)
Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
上级 ecc7a24c
...@@ -119,6 +119,13 @@ static void commit_complete(BlockJob *job, void *opaque) ...@@ -119,6 +119,13 @@ static void commit_complete(BlockJob *job, void *opaque)
} }
g_free(s->backing_file_str); g_free(s->backing_file_str);
blk_unref(s->top); blk_unref(s->top);
/* If there is more than one reference to the job (e.g. if called from
* block_job_finish_sync()), block_job_completed() won't free it and
* therefore the blockers on the intermediate nodes remain. This would
* cause bdrv_set_backing_hd() to fail. */
block_job_remove_all_bdrv(job);
block_job_completed(&s->common, ret); block_job_completed(&s->common, ret);
g_free(data); g_free(data);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册