]> Git Repo - qemu.git/commit
block: Dec. drained_end_counter before bdrv_wakeup
authorMax Reitz <[email protected]>
Mon, 22 Jul 2019 13:30:53 +0000 (15:30 +0200)
committerMax Reitz <[email protected]>
Mon, 22 Jul 2019 16:41:35 +0000 (18:41 +0200)
commit65181d63817b33b10ecb1c418eb96c99e7cf8842
tree8c5619e74ceeab10b9dc6826dba86c622f4b29fd
parent258867d1dc32c300690cc32bfcf3e648ae12c4c9
block: Dec. drained_end_counter before bdrv_wakeup

Decrementing drained_end_counter after bdrv_dec_in_flight() (which in
turn invokes bdrv_wakeup() and thus aio_wait_kick()) is not very clever.
We should decrement it beforehand, so that any waiting aio_poll() that
is woken by bdrv_dec_in_flight() sees the decremented
drained_end_counter.

Because the time window between decrementing drained_end_counter and
aio_wait_kick() is very small, I cannot supply a reliable regression
test.  However, running e.g. the /bdrv-drain/blockjob/iothread/drain_all
test in test-bdrv-drain has a small chance of hanging without this
patch (about 1/200 or so; it gets to nearly 100 % if you add e.g. an
fputc(' ', stderr); after the bdrv_dec_in_flight()).

Fixes: e037c09c78520cbdb6da7cfc6ad0256d5870b814
Signed-off-by: Max Reitz <[email protected]>
Message-id: 20190722133054[email protected]
Signed-off-by: Max Reitz <[email protected]>
block/io.c
This page took 0.027133 seconds and 4 git commands to generate.