]> git.proxmox.com Git - mirror_qemu.git/commit - block/block-backend.c
block: add BlockBackend->in_flight counter
authorStefan Hajnoczi <stefanha@redhat.com>
Fri, 16 Feb 2018 16:50:13 +0000 (16:50 +0000)
committerKevin Wolf <kwolf@redhat.com>
Fri, 2 Mar 2018 17:39:07 +0000 (18:39 +0100)
commit33f2a7577787910bda161f428c904ac6a14b2454
treedb049b4cacc288b6f3c5b7314baac4ea0ab25ffe
parent7719f3c968c59e1bcda7e177679dc765b59e578f
block: add BlockBackend->in_flight counter

BlockBackend currently relies on BlockDriverState->in_flight to track
requests for blk_drain().  There is a corner case where
BlockDriverState->in_flight cannot be used though: blk->root can be NULL
when there is no medium.  This results in a segfault when the NULL
pointer is dereferenced.

Introduce a BlockBackend->in_flight counter for aio requests so it works
even when blk->root == NULL.

Based on a patch by Kevin Wolf <kwolf@redhat.com>.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block.c
block/block-backend.c