diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2016-08-18 14:42:51 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2016-08-18 14:42:51 +0100 |
commit | 02b1ad881cbb1795029737a9077db60267dc0c6f (patch) | |
tree | cb957f9d06a1dcd3591dc4a19b03edfe0018ff97 /block/io.c | |
parent | 5844365fe8e5e4598222d276d2af54fd45c7e3d3 (diff) | |
parent | 156af3ac98da24f0155eed18ec546157436d6b2e (diff) |
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
# gpg: Signature made Thu 18 Aug 2016 14:39:31 BST
# gpg: using RSA key 0x9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>"
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35 775A 9CA4 ABB3 81AB 73C8
* remotes/stefanha/tags/block-pull-request:
block: fix possible reorder of flush operations
block: fix deadlock in bdrv_co_flush
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'block/io.c')
-rw-r--r-- | block/io.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/block/io.c b/block/io.c index d5493ba349..420944d80d 100644 --- a/block/io.c +++ b/block/io.c @@ -2283,11 +2283,11 @@ int coroutine_fn bdrv_co_flush(BlockDriverState *bs) int current_gen = bs->write_gen; /* Wait until any previous flushes are completed */ - while (bs->flush_started_gen != bs->flushed_gen) { + while (bs->active_flush_req != NULL) { qemu_co_queue_wait(&bs->flush_queue); } - bs->flush_started_gen = current_gen; + bs->active_flush_req = &req; /* Write back all layers by calling one driver function */ if (bs->drv->bdrv_co_flush) { @@ -2357,7 +2357,9 @@ flush_parent: out: /* Notify any pending flushes that we have completed */ bs->flushed_gen = current_gen; - qemu_co_queue_restart_all(&bs->flush_queue); + bs->active_flush_req = NULL; + /* Return value is ignored - it's ok if wait queue is empty */ + qemu_co_queue_next(&bs->flush_queue); tracked_request_end(&req); return ret; |