mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-31 05:51:53 -06:00
blockjob: Remove the job from the list earlier in block_job_unref()
When destroying a block job in block_job_unref() we should remove it from the job list before calling block_job_remove_all_bdrv(). This is because removing the BDSs can trigger an aio_poll() and wake up other jobs that might attempt to use the block job list. If that happens the job we're currently destroying should not be in that list anymore. Signed-off-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
c117bb14ff
commit
0a3e155f3f
1 changed files with 1 additions and 1 deletions
|
@ -152,6 +152,7 @@ void block_job_unref(BlockJob *job)
|
||||||
{
|
{
|
||||||
if (--job->refcnt == 0) {
|
if (--job->refcnt == 0) {
|
||||||
BlockDriverState *bs = blk_bs(job->blk);
|
BlockDriverState *bs = blk_bs(job->blk);
|
||||||
|
QLIST_REMOVE(job, job_list);
|
||||||
bs->job = NULL;
|
bs->job = NULL;
|
||||||
block_job_remove_all_bdrv(job);
|
block_job_remove_all_bdrv(job);
|
||||||
blk_remove_aio_context_notifier(job->blk,
|
blk_remove_aio_context_notifier(job->blk,
|
||||||
|
@ -160,7 +161,6 @@ void block_job_unref(BlockJob *job)
|
||||||
blk_unref(job->blk);
|
blk_unref(job->blk);
|
||||||
error_free(job->blocker);
|
error_free(job->blocker);
|
||||||
g_free(job->id);
|
g_free(job->id);
|
||||||
QLIST_REMOVE(job, job_list);
|
|
||||||
g_free(job);
|
g_free(job);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue