vhost_user_backend: Don't process disabled queues

Every time an event is triggered, it needs to be read, but only based on
the status of the vring (enabled or not) will decide if the queue needs
to be processed.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf 2019-09-17 07:43:22 -07:00
parent d80ac43ef1
commit c1b26b1fab

View File

@ -329,6 +329,12 @@ impl<S: VhostUserBackend> VringEpollHandler<S> {
.map_err(VringEpollHandlerError::HandleEventReadKick)?;
}
// If the vring is not enabled, it should not be processed.
// The event is only read to be discarded.
if !self.vrings[device_event as usize].read().unwrap().enabled {
return Ok(false);
}
self.process_queue(device_event)?;
Ok(false)
}