mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
virtio-devices: block: make shutdown join the worker
eject_device calls shutdown, but Block doesn't implement it, so the worker thread was never joined. Drop for Block does not help either, VirtioPciDevice keeps an Arc<Mutex<Block>> past eject, so Drop never runs. The async worker keeps completing in-flight I/O into the guest RAM that backed it when issued. Implement shutdown() to call wait_for_epoll_threads(), which drops the WorkerThreads handle and ensures that worker's io completes. Signed-off-by: Dylan Reid <dgreid@fb.com>
This commit is contained in:
@@ -1167,6 +1167,10 @@ impl VirtioDevice for Block {
|
||||
event!("virtio-device", "reset", "id", &self.id);
|
||||
}
|
||||
|
||||
fn shutdown(&mut self) {
|
||||
self.common.wait_for_epoll_threads();
|
||||
}
|
||||
|
||||
fn counters(&self) -> Option<HashMap<&'static str, Wrapping<u64>>> {
|
||||
let mut counters = HashMap::new();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user