On Wed, Sep 08, 2021 at 09:10:21AM -0400, Emanuele Giuseppe Esposito wrote: > @@ -1767,12 +1817,14 @@ void blk_drain_all(void) > void blk_set_on_error(BlockBackend *blk, BlockdevOnError on_read_error, > BlockdevOnError on_write_error) > { > + g_assert(qemu_in_main_thread()); > blk->on_read_error = on_read_error; > blk->on_write_error = on_write_error; > } > > BlockdevOnError blk_get_on_error(BlockBackend *blk, bool is_read) > { > + g_assert(qemu_in_main_thread()); > return is_read ? blk->on_read_error : blk->on_write_error; > } > > @@ -1780,6 +1832,7 @@ BlockErrorAction blk_get_error_action(BlockBackend > *blk, bool is_read, > int error) > { > BlockdevOnError on_err = blk_get_on_error(blk, is_read); > + g_assert(qemu_in_main_thread()); > > switch (on_err) { > case BLOCKDEV_ON_ERROR_ENOSPC: > @@ -1819,6 +1872,7 @@ void blk_error_action(BlockBackend *blk, > BlockErrorAction action, > bool is_read, int error) > { > assert(error >= 0); > + g_assert(qemu_in_main_thread()); > > if (action == BLOCK_ERROR_ACTION_STOP) { > /* First set the iostatus, so that "info block" returns an iostatus
The error action APIs are called from the I/O code path. For example, hw/block/virtio-blk.c:virtio_blk_handle_rw_error() is called from an IOThread with -device virtio-blk-pci,iothread=... with the AioContext held. > @@ -1983,11 +2045,13 @@ uint32_t blk_get_max_transfer(BlockBackend *blk) > > int blk_get_max_iov(BlockBackend *blk) > { > + g_assert(qemu_in_main_thread()); > return blk->root->bs->bl.max_iov; > } This is called by hw/block/virtio-blk.c:virtio_blk_submit_multireq() from an IOThread with the AioContext held.
signature.asc
Description: PGP signature