[PULL 14/22] vhost: fix the fd leak

Michael S. Tsirkin posted 22 patches 2 years, 6 months ago
Maintainers: "Gonglei (Arei)" <arei.gonglei@huawei.com>, Zhenwei Pi <pizhenwei@bytedance.com>, "Michael S. Tsirkin" <mst@redhat.com>, Igor Mammedov <imammedo@redhat.com>, Ani Sinha <anisinha@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Eduardo Habkost <eduardo@habkost.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Peter Xu <peterx@redhat.com>, Jason Wang <jasowang@redhat.com>, Eric Auger <eric.auger@redhat.com>
[PULL 14/22] vhost: fix the fd leak
Posted by Michael S. Tsirkin 2 years, 6 months ago
From: Li Feng <fengli@smartx.com>

When the vhost-user reconnect to the backend, the notifer should be
cleanup. Otherwise, the fd resource will be exhausted.

Fixes: f9a09ca3ea ("vhost: add support for configure interrupt")

Signed-off-by: Li Feng <fengli@smartx.com>
Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
Message-Id: <20230731121018.2856310-2-fengli@smartx.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Fiona Ebner <f.ebner@proxmox.com>
---
 hw/virtio/vhost.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index abf0d03c8d..e2f6ffb446 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -2044,6 +2044,8 @@ void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev, bool vrings)
     event_notifier_test_and_clear(
         &hdev->vqs[VHOST_QUEUE_NUM_CONFIG_INR].masked_config_notifier);
     event_notifier_test_and_clear(&vdev->config_notifier);
+    event_notifier_cleanup(
+        &hdev->vqs[VHOST_QUEUE_NUM_CONFIG_INR].masked_config_notifier);
 
     trace_vhost_dev_stop(hdev, vdev->name, vrings);
 
-- 
MST
Re: [PULL 14/22] vhost: fix the fd leak
Posted by Michael Tokarev 2 years, 6 months ago
04.08.2023 01:21, Michael S. Tsirkin wrote:
> From: Li Feng <fengli@smartx.com>
> 
> When the vhost-user reconnect to the backend, the notifer should be
> cleanup. Otherwise, the fd resource will be exhausted.
> 
> Fixes: f9a09ca3ea ("vhost: add support for configure interrupt")
> 
> Signed-off-by: Li Feng <fengli@smartx.com>
> Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
> Message-Id: <20230731121018.2856310-2-fengli@smartx.com>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> Tested-by: Fiona Ebner <f.ebner@proxmox.com>

This smells like a stable-8.0 material. Please let me know if it is not.

/mjt
Re: [PULL 14/22] vhost: fix the fd leak
Posted by Michael Tokarev 2 years, 6 months ago
04.08.2023 07:36, Michael Tokarev wrote:
> This smells like a stable-8.0 material. Please let me know if it is not.

Ah, it is, Cc'd -stable already. N/m, picked this one up.

/mjt