From 22649c4a87900cf54f7833c7cc8b86364817c331 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Thu, 14 Jan 2021 13:45:14 +0000 Subject: [PATCH] virtio-devices: Upon reset reap/join the device threads We have killed the device thread by writing to the exit EventFd but we should wait for them to quit to ensure consistency. Signed-off-by: Rob Bradford --- virtio-devices/src/device.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/virtio-devices/src/device.rs b/virtio-devices/src/device.rs index 1a11a0a37..6371ac107 100644 --- a/virtio-devices/src/device.rs +++ b/virtio-devices/src/device.rs @@ -299,6 +299,14 @@ impl VirtioCommon { let _ = kill_evt.write(1); } + if let Some(mut threads) = self.epoll_threads.take() { + for t in threads.drain(..) { + if let Err(e) = t.join() { + error!("Error joining thread: {:?}", e); + } + } + } + // Return the interrupt and queue EventFDs Some(( self.interrupt_cb.take().unwrap(),