block: Call .drain_begin only once in bdrv_drain_all_begin()
commit2da9b7d456278bccc6ce889ae350f2867155d7e8
authorKevin Wolf <kwolf@redhat.com>
Tue, 5 Dec 2017 12:53:35 +0000 (5 13:53 +0100)
committerKevin Wolf <kwolf@redhat.com>
Fri, 22 Dec 2017 14:03:41 +0000 (22 15:03 +0100)
treed2b2270a3b02588d81d005286676d12611f72c60
parentdb0289b9b26cb653d5662f5d6a2a52d70243cd56
block: Call .drain_begin only once in bdrv_drain_all_begin()

bdrv_drain_all_begin() used to call the .bdrv_co_drain_begin() driver
callback inside its polling loop. This means that how many times it got
called for each node depended on long it had to poll the event loop.

This is obviously not right and results in nodes that stay drained even
after bdrv_drain_all_end(), which calls .bdrv_co_drain_begin() once per
node.

Fix bdrv_drain_all_begin() to call the callback only once, too.

Cc: qemu-stable@nongnu.org
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
block/io.c