diff --git a/virtio-devices/src/block.rs b/virtio-devices/src/block.rs index 037293948..2a7f751e1 100644 --- a/virtio-devices/src/block.rs +++ b/virtio-devices/src/block.rs @@ -482,7 +482,9 @@ impl VirtioDevice for Block { })?; self.pause_evt = Some(self_pause_evt); - let disk_image_id = build_disk_image_id(&self.disk_path); + // Save the interrupt EventFD as we need to return it on reset + // but clone it to pass into the thread. + self.interrupt_cb = Some(interrupt_cb.clone()); let mut tmp_queue_evts: Vec = Vec::new(); for queue_evt in queue_evts.iter() { @@ -495,6 +497,7 @@ impl VirtioDevice for Block { } self.queue_evts = Some(tmp_queue_evts); + let disk_image_id = build_disk_image_id(&self.disk_path); let event_idx = self.common.feature_acked(VIRTIO_RING_F_EVENT_IDX.into()); self.update_writeback(); @@ -542,10 +545,6 @@ impl VirtioDevice for Block { })?; } - // Save the interrupt EventFD as we need to return it on reset - // but clone it to pass into the thread. - self.interrupt_cb = Some(interrupt_cb); - self.epoll_threads = Some(epoll_threads); Ok(())