vm-virtio: vhost_user: block: On shutdown() drop the socket

This causes the vhost-user-block backend to shutdown.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2020-02-14 10:08:59 +00:00
parent 7fabca3548
commit 4d60ef59bc

View File

@ -14,6 +14,7 @@ use libc::EFD_NONBLOCK;
use std::cmp;
use std::io::Write;
use std::mem;
use std::os::unix::io::AsRawFd;
use std::result;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
@ -314,6 +315,10 @@ impl VirtioDevice for Blk {
self.queue_evts.take().unwrap(),
))
}
fn shutdown(&mut self) {
let _ = unsafe { libc::close(self.vhost_user_blk.as_raw_fd()) };
}
}
virtio_pausable!(Blk);