diff options
| author | Alberto Garcia <berto@igalia.com> | 2017-11-28 16:53:27 +0200 |
|---|---|---|
| committer | Kevin Wolf <kwolf@redhat.com> | 2017-11-28 16:59:24 +0100 |
| commit | 0a3e155f3f5ec9b6f12d00894c7701b3cbb66590 (patch) | |
| tree | f1f14f5166780592295d1e3602ac5b4c91ed88bb | |
| parent | c117bb14ff633848cc6b0ff77f081f583dfa8c5e (diff) | |
| download | focaccia-qemu-0a3e155f3f5ec9b6f12d00894c7701b3cbb66590.tar.gz focaccia-qemu-0a3e155f3f5ec9b6f12d00894c7701b3cbb66590.zip | |
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>
| -rw-r--r-- | blockjob.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/blockjob.c b/blockjob.c index ff9a614531..2f0cc1528b 100644 --- a/blockjob.c +++ b/blockjob.c @@ -152,6 +152,7 @@ void block_job_unref(BlockJob *job) { if (--job->refcnt == 0) { BlockDriverState *bs = blk_bs(job->blk); + QLIST_REMOVE(job, job_list); bs->job = NULL; block_job_remove_all_bdrv(job); blk_remove_aio_context_notifier(job->blk, @@ -160,7 +161,6 @@ void block_job_unref(BlockJob *job) blk_unref(job->blk); error_free(job->blocker); g_free(job->id); - QLIST_REMOVE(job, job_list); g_free(job); } } |