From 92b58ba94a397f01c2a589495d2aea58487874b0 Mon Sep 17 00:00:00 2001 From: Demi Marie Obenour Date: Mon, 9 Feb 2026 14:02:54 -0500 Subject: [PATCH] virtio-devices: Do not close an unowned FD Instead of closing a file descriptor that belongs to the vhost-user frontend, drop the vu_common_ctrl::VhostUserHandle and the vhost::vhost_user::Frontend it contains. This causes the destructor to drop the file descriptor. This breaks the last DPDK test, so disable it. See #7689. Fixes: #7163 Signed-off-by: Demi Marie Obenour --- cloud-hypervisor/tests/integration.rs | 1 + virtio-devices/src/vhost_user/mod.rs | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/cloud-hypervisor/tests/integration.rs b/cloud-hypervisor/tests/integration.rs index 5566caf98..d2f255645 100644 --- a/cloud-hypervisor/tests/integration.rs +++ b/cloud-hypervisor/tests/integration.rs @@ -12440,6 +12440,7 @@ mod live_migration { } #[test] + #[ignore = "See #5532 and #7689"] #[cfg(target_arch = "x86_64")] #[cfg(not(feature = "mshv"))] fn test_live_migration_ovs_dpdk_local() { diff --git a/virtio-devices/src/vhost_user/mod.rs b/virtio-devices/src/vhost_user/mod.rs index 05233a0be..7e2c162cb 100644 --- a/virtio-devices/src/vhost_user/mod.rs +++ b/virtio-devices/src/vhost_user/mod.rs @@ -375,15 +375,13 @@ impl VhostUserCommon { } pub fn shutdown(&mut self) { - if let Some(vu) = &self.vu { - // SAFETY: trivially safe - let _ = unsafe { libc::close(vu.lock().unwrap().socket_handle().as_raw_fd()) }; - } - // Remove socket path if needed if self.server { let _ = std::fs::remove_file(&self.socket_path); } + + // Drop the vhost-user handle + self.vu = None; } pub fn add_memory_region(