diff --git a/vm-virtio/src/vhost_user/fs.rs b/vm-virtio/src/vhost_user/fs.rs index 14631184a..e8debdf5e 100644 --- a/vm-virtio/src/vhost_user/fs.rs +++ b/vm-virtio/src/vhost_user/fs.rs @@ -13,7 +13,7 @@ use libc::{self, c_void, off64_t, pread64, pwrite64, EFD_NONBLOCK}; use std::cmp; use std::io; use std::io::Write; -use std::os::unix::io::RawFd; +use std::os::unix::io::{AsRawFd, RawFd}; use std::result; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::{Arc, Mutex}; @@ -544,6 +544,10 @@ impl VirtioDevice for Fs { )) } + fn shutdown(&mut self) { + let _ = unsafe { libc::close(self.vu.as_raw_fd()) }; + } + fn get_shm_regions(&self) -> Option { if let Some(cache) = self.cache.as_ref() { Some(cache.0.clone())