aboutsummaryrefslogtreecommitdiff
path: root/blockjob.c
diff options
context:
space:
mode:
authorsochin.jiang <sochin.jiang@huawei.com>2017-06-15 14:47:33 +0800
committerMax Reitz <mreitz@redhat.com>2017-06-26 14:54:46 +0200
commit4172a00373b2c81374293becc02b16b7f8c76659 (patch)
treefd448d57f39b13a48460c626bc6d3a49e6e7ccca /blockjob.c
parentf5a5ca796932d04cb2a1cb9382a55f72795b3e06 (diff)
fix: avoid an infinite loop or a dangling pointer problem in img_commit
img_commit could fall into an infinite loop calling run_block_job() if its blockjob fails on any I/O error, fix this already known problem. Signed-off-by: sochin.jiang <sochin.jiang@huawei.com> Message-id: 1497509253-28941-1-git-send-email-sochin.jiang@huawei.com Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'blockjob.c')
-rw-r--r--blockjob.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/blockjob.c b/blockjob.c
index a0d7e29b83..70a78188b7 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -139,7 +139,7 @@ static void block_job_resume(BlockJob *job)
block_job_enter(job);
}
-static void block_job_ref(BlockJob *job)
+void block_job_ref(BlockJob *job)
{
++job->refcnt;
}
@@ -148,7 +148,7 @@ static void block_job_attached_aio_context(AioContext *new_context,
void *opaque);
static void block_job_detach_aio_context(void *opaque);
-static void block_job_unref(BlockJob *job)
+void block_job_unref(BlockJob *job)
{
if (--job->refcnt == 0) {
BlockDriverState *bs = blk_bs(job->blk);