From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: dev@dpdk.org, david.marchand@redhat.com, chenbox@nvidia.com
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
Subject: [RFC 3/3] vhost: improve VDUSE reconnect handler cleanup
Date: Tue, 24 Dec 2024 16:49:58 +0100 [thread overview]
Message-ID: <20241224154958.146852-4-maxime.coquelin@redhat.com> (raw)
In-Reply-To: <20241224154958.146852-1-maxime.coquelin@redhat.com>
This patch makes use of the new FD entry cleanup callback
to close the VDUSE reconnect eventfd after its removal
from the FD set.
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
lib/vhost/vduse.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/lib/vhost/vduse.c b/lib/vhost/vduse.c
index 9c10fbc684..a841da966c 100644
--- a/lib/vhost/vduse.c
+++ b/lib/vhost/vduse.c
@@ -563,16 +563,21 @@ vduse_reconnect_log_check(struct virtio_net *dev, uint64_t features, uint32_t to
}
static void
-vduse_reconnect_handler(int fd, void *arg, int *remove)
+vduse_reconnect_handler(int fd __rte_unused, void *arg, int *remove)
{
struct virtio_net *dev = arg;
vduse_device_start(dev, true);
- close(fd);
*remove = 1;
}
+static void
+vduse_reconnect_handler_cleanup(int fd, void *arg __rte_unused)
+{
+ close(fd);
+}
+
static int
vduse_reconnect_start_device(struct virtio_net *dev)
{
@@ -590,7 +595,8 @@ vduse_reconnect_start_device(struct virtio_net *dev)
goto out_err;
}
- ret = fdset_add(vduse.fdset, fd, vduse_reconnect_handler, NULL, NULL, dev);
+ ret = fdset_add(vduse.fdset, fd, vduse_reconnect_handler, NULL,
+ vduse_reconnect_handler_cleanup, dev);
if (ret) {
VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to add reconnect efd %d to vduse fdset",
fd);
--
2.47.1
prev parent reply other threads:[~2024-12-24 15:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-24 15:49 [RFC 0/3] Vhost: fix FD entries cleanup Maxime Coquelin
2024-12-24 15:49 ` [RFC 1/3] vhost: add cleanup callback to FD entries Maxime Coquelin
2024-12-24 15:49 ` [RFC 2/3] vhost: fix vhost-user socket cleanup order Maxime Coquelin
2024-12-24 15:49 ` Maxime Coquelin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241224154958.146852-4-maxime.coquelin@redhat.com \
--to=maxime.coquelin@redhat.com \
--cc=chenbox@nvidia.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).