]> git.proxmox.com Git - mirror_qemu.git/commit - tests/unit/test-bdrv-drain.c
test-bdrv-drain: Fix incorrrect drain assumptions
authorKevin Wolf <kwolf@redhat.com>
Wed, 7 Dec 2022 13:18:29 +0000 (14:18 +0100)
committerKevin Wolf <kwolf@redhat.com>
Thu, 15 Dec 2022 15:08:23 +0000 (16:08 +0100)
commit617f3a963589dbd54fe1f323eeac36411b352a0e
tree241e42ed3cdd80a6cefa46d111df1b975f9d1312
parentd9bfb9de00d4ee15908cc2f76333d6657b580dea
test-bdrv-drain: Fix incorrrect drain assumptions

The test case assumes that a drain only happens in one specific place
where it drains explicitly. This assumption happened to hold true until
now, but block layer functions may drain interally (any graph
modifications are going to do that through bdrv_graph_wrlock()), so this
is incorrect. Make sure that the test code in .drained_begin only runs
where we actually want it to run.

When scheduling a BH from .drained_begin, we also need to increase the
in_flight counter to make sure that the operation is actually completed
in time before the node that it works on goes away.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20221207131838.239125-10-kwolf@redhat.com>
Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
tests/unit/test-bdrv-drain.c