From dd3a2f2649b7ace3a2bfe08c8ddbdab6dfa5d46f Mon Sep 17 00:00:00 2001 From: Dylan Reid Date: Mon, 4 May 2026 18:27:38 -0700 Subject: [PATCH] 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> 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 --- virtio-devices/src/block.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/virtio-devices/src/block.rs b/virtio-devices/src/block.rs index e01eb7ec2..04831f871 100644 --- a/virtio-devices/src/block.rs +++ b/virtio-devices/src/block.rs @@ -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>> { let mut counters = HashMap::new();