]> git.ipfire.org Git - thirdparty/qemu.git/commit
qemu-io: Drop write permissions before read-only reopen
authorKevin Wolf <kwolf@redhat.com>
Fri, 22 Sep 2017 12:50:12 +0000 (14:50 +0200)
committerKevin Wolf <kwolf@redhat.com>
Tue, 26 Sep 2017 12:46:23 +0000 (14:46 +0200)
commitf3adefb2cea1c63b7b198acaef5e40eb4b2d2d39
tree38b95ac286ddedae55d3b540c0a52db6c1b6984f
parent7a6ab45e19b615b9285b9cfa2bbc1fee012bc8d7
qemu-io: Drop write permissions before read-only reopen

qemu-io provides a 'reopen' command that allows switching from writable
to read-only access. We need to make sure that we don't try to keep
write permissions to a BlockBackend that becomes read-only, otherwise
things are going to fail.

This requires a bdrv_drain() call because otherwise in-flight AIO
write requests could issue new internal requests while the permission
has already gone away, which would cause assertion failures. Draining
the queue doesn't break AIO requests in any new way, bdrv_reopen() would
drain it anyway only a few lines later.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
qemu-io-cmds.c
tests/qemu-iotests/187.out