mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-01 17:35:19 +00:00
vhost_user_block: Forward the error from unexpected event
This is consistent with vhost-user-net and vhost-user-fs. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
4f4c3d3ebe
commit
710394b872
@ -27,12 +27,12 @@ use std::process;
|
||||
use std::slice;
|
||||
use std::sync::{Arc, RwLock};
|
||||
use std::vec::Vec;
|
||||
use std::{convert, error, fmt, io};
|
||||
use vhost_rs::vhost_user::message::*;
|
||||
use vhost_user_backend::{VhostUserBackend, VhostUserDaemon, Vring, VringWorker};
|
||||
use virtio_bindings::bindings::virtio_blk::*;
|
||||
use vm_memory::{Bytes, GuestMemoryError, GuestMemoryMmap};
|
||||
use vm_virtio::block::{build_disk_image_id, Request};
|
||||
use std::{fmt, error, convert,io};
|
||||
|
||||
const QUEUE_SIZE: usize = 1024;
|
||||
const SECTOR_SHIFT: u8 = 9;
|
||||
@ -63,6 +63,8 @@ pub enum Error {
|
||||
ParseReadOnlyParam,
|
||||
/// Failed parsing fs number of queues parameter.
|
||||
ParseBlkNumQueuesParam(std::num::ParseIntError),
|
||||
/// Failed to handle event other than input event.
|
||||
HandleEventNotEpollIn,
|
||||
}
|
||||
|
||||
impl fmt::Display for Error {
|
||||
@ -214,8 +216,7 @@ impl VhostUserBackend for VhostUserBlkBackend {
|
||||
vrings: &[Arc<RwLock<Vring>>],
|
||||
) -> VhostUserBackendResult<bool> {
|
||||
if evset != epoll::Events::EPOLLIN {
|
||||
warn!("invalid events operation");
|
||||
return Ok(false);
|
||||
return Err(Error::HandleEventNotEpollIn.into());
|
||||
}
|
||||
|
||||
debug!("event received: {:?}", device_event);
|
||||
|
Loading…
x
Reference in New Issue
Block a user