mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
virtio-devices: vhost_user: refuse activate when disconnected
If a guest observes DEVICE_NEEDS_RESET, resets the device, and tries to re-initialize it, but the VMM knows the backend is disconnected, we can short-circuit the doomed activation. This is not incorrect, but saves the VMM from making several round-trip calls to a peer process that doesn't exist. It'll also make the logs cleaner. Signed-off-by: Dylan Reid <dgreid@fb.com>
This commit is contained in:
@@ -480,6 +480,14 @@ impl VhostUserCommon {
|
||||
kill_evt: EventFd,
|
||||
pause_evt: EventFd,
|
||||
) -> std::result::Result<VhostUserEpollHandler<T>, ActivateError> {
|
||||
if self.disconnected.load(Ordering::Relaxed) {
|
||||
warn!(
|
||||
"Not activating disconnected vhost-user device for socket {}",
|
||||
self.socket_path
|
||||
);
|
||||
return Err(ActivateError::BadActivate);
|
||||
}
|
||||
|
||||
let mut inflight: Option<Inflight> =
|
||||
if self.acked_protocol_features & VhostUserProtocolFeatures::INFLIGHT_SHMFD.bits() != 0
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user