From 5877fa99c889bb40c0f5af1613881df3ff8c3cf4 Mon Sep 17 00:00:00 2001 From: sujerry1991 Date: Thu, 19 Jun 2025 21:46:35 +0800 Subject: [PATCH] virtio-net: do not delete fd which has not been added Signed-off-by: sujerry1991 --- ...ot-delete-fd-which-has-not-been-added.patch | 18 ++++++++++++++++++ stratovirt.spec | 6 +++++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 0011-virtio-net-do-not-delete-fd-which-has-not-been-added.patch diff --git a/0011-virtio-net-do-not-delete-fd-which-has-not-been-added.patch b/0011-virtio-net-do-not-delete-fd-which-has-not-been-added.patch new file mode 100644 index 0000000..a957212 --- /dev/null +++ b/0011-virtio-net-do-not-delete-fd-which-has-not-been-added.patch @@ -0,0 +1,18 @@ +diff --git a/virtio/src/device/net.rs b/virtio/src/device/net.rs +index 4e605fa..84e5ce6 100644 +--- a/virtio/src/device/net.rs ++++ b/virtio/src/device/net.rs +@@ -977,11 +977,11 @@ impl NetIoHandler { + let mut notifiers_fds = vec![ + locked_net_io.update_evt.as_raw_fd(), + locked_net_io.rx.queue_evt.as_raw_fd(), +- locked_net_io.rx.recv_evt.as_raw_fd(), + locked_net_io.tx.queue_evt.as_raw_fd(), + ]; + if old_tap_fd != -1 { + notifiers_fds.push(old_tap_fd); ++ notifiers_fds.push(locked_net_io.rx.recv_evt.as_raw_fd()); + } + let mut notifiers = gen_delete_notifiers(¬ifiers_fds); + drop(locked_net_io); + diff --git a/stratovirt.spec b/stratovirt.spec index 9465ff1..27361b1 100644 --- a/stratovirt.spec +++ b/stratovirt.spec @@ -6,7 +6,7 @@ Name: stratovirt Version: 2.4.0 -Release: 9 +Release: 10 Summary: StratoVirt is an opensource VMM(Virtual Machine Manager) which aims to perform next generation virtualization. License: MulanPSL-2.0 @@ -27,6 +27,7 @@ Patch007:0007-vfio-pci-fix-a-deadlock-problem.patch Patch008:0008-QMP-bugfix-the-error-in-the-return-result-of-query_c.patch Patch009:0009-QMP-add-query-cpus-fast.patch Patch010:0010-add-support-to-interconnecting-with-libvirt.patch +Patch011:0011-virtio-net-do-not-delete-fd-which-has-not-been-added.patch ExclusiveArch: x86_64 aarch64 riscv64 @@ -132,6 +133,9 @@ install -D -m555 ./target/%{rust_musl_target}/release/stratovirt %{buildroot}%{_ %endif %changelog +* Thu Jun 19 2025 Yan Wang 2.4.0-10 +- Do not delete fd which has not been added + * Fri May 23 2025 Ming Yang 2.4.0-9 - add support to interconnect with libvirt -- Gitee