v2: Address Stefan's comments: - Clean up redundancy in bdrv_format_default_perms change. - Add a test case to check both success/failure cases. A failure case is not possible at user interface level because of other checks we have, so write a unit test in tests/test-blk-perm.c.
Eject / change of scsi-cd on a virtio-scsi dataplane bus causes abort() because the new BDS doesn't get proper bdrv_set_aio_context(). Store the AioContext in BB and do it in blk_insert_bs. That is done by Vladimir's patch. Other patches are to make sure such a bdrv_set_aio_context() doesn't interfere with other BBs using other nodes from this graph. Fam Fam Zheng (15): block: Define BLK_PERM_AIO_CONTEXT_CHANGE block-backend: Add blk_request_perm blockjob: Add BLK_PERM_AIO_CONTEXT_CHANGE shared perm on bs blockjob: Allow aio context change on intermediate nodes block: Propagate BLK_PERM_AIO_CONTEXT_CHANGE down the graph backup: Request BLK_PERM_AIO_CONTEXT_CHANGE on target backup: Do initial aio context move of target via BB interface mirror: Request aio context change permission on target commit: Allow aio context change on s->base mirror: Do initial aio context move of target via BB interface virtio-scsi: Request BLK_PERM_AIO_CONTEXT_CHANGE for dataplane virtio-blk: Request BLK_PERM_AIO_CONTEXT_CHANGE for dataplane nbd: Allow BLK_PERM_AIO_CONTEXT_CHANGE on BB block: Add perm assertion on blk_set_aio_context tests: Add test case for BLK_PERM_AIO_CONTEXT_CHANGE Vladimir Sementsov-Ogievskiy (1): blk: fix aio context loss on media change block.c | 12 ++++++--- block/backup.c | 11 +++++++- block/block-backend.c | 22 +++++++++++++++ block/commit.c | 6 +++-- block/mirror.c | 13 ++++++++- block/stream.c | 3 ++- block/vvfat.c | 2 +- blockdev.c | 18 ------------- blockjob.c | 3 +++ hw/block/dataplane/virtio-blk.c | 15 ++++++++--- hw/scsi/virtio-scsi.c | 4 +++ include/block/block.h | 7 ++++- include/sysemu/block-backend.h | 1 + nbd/server.c | 6 +++-- tests/Makefile.include | 2 ++ tests/test-blk-perm.c | 59 +++++++++++++++++++++++++++++++++++++++++ 16 files changed, 149 insertions(+), 35 deletions(-) create mode 100644 tests/test-blk-perm.c -- 2.9.3