diff options
author | Hanna Czenczek <hreitz@redhat.com> | 2024-02-02 15:47:55 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2024-02-07 14:55:32 +0100 |
commit | 1604c0493193273e4eac547f86fbd2845e7f9af4 (patch) | |
tree | 6cf40d7c40eb07fb365e9db0669f4ede506ebcea /docs/sphinx/qapidoc.py | |
parent | ad893672027ffe26db498947d70cde6d4f58a111 (diff) | |
download | qemu-1604c0493193273e4eac547f86fbd2845e7f9af4.zip qemu-1604c0493193273e4eac547f86fbd2845e7f9af4.tar.gz qemu-1604c0493193273e4eac547f86fbd2845e7f9af4.tar.bz2 |
scsi: Await request purging
scsi_device_for_each_req_async() currently does not provide any way to
be awaited. One of its callers is scsi_device_purge_requests(), which
therefore currently does not guarantee that all requests are fully
settled when it returns.
We want all requests to be settled, because scsi_device_purge_requests()
is called through the unrealize path, including the one invoked by
virtio_scsi_hotunplug() through qdev_simple_device_unplug_cb(), which
most likely assumes that all SCSI requests are done then.
In fact, scsi_device_purge_requests() already contains a blk_drain(),
but this will not fully await scsi_device_for_each_req_async(), only the
I/O requests it potentially cancels (not the non-I/O requests).
However, we can have scsi_device_for_each_req_async() increment the BB
in-flight counter, and have scsi_device_for_each_req_async_bh()
decrement it when it is done. This way, the blk_drain() will fully
await all SCSI requests to be purged.
This also removes the need for scsi_device_for_each_req_async_bh() to
double-check the current context and potentially re-schedule itself,
should it now differ from the BB's context: Changing a BB's AioContext
with a root node is done through bdrv_try_change_aio_context(), which
creates a drained section. With this patch, we keep the BB in-flight
counter elevated throughout, so we know the BB's context cannot change.
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
Message-ID: <20240202144755.671354-3-hreitz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'docs/sphinx/qapidoc.py')
0 files changed, 0 insertions, 0 deletions