DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] vhost: only emit debug log with invalid FD
@ 2024-06-24 14:46 Maxime Coquelin
  2024-06-25  7:35 ` David Marchand
  0 siblings, 1 reply; 3+ messages in thread
From: Maxime Coquelin @ 2024-06-24 14:46 UTC (permalink / raw)
  To: dev, david.marchand, chenbox; +Cc: Maxime Coquelin

This patch improves the FD manager logging in case
of FD removal from the epoll FD set failure.

When the FD is not more valid, like for example if it
has already been closed, only emit a debug log and not
an error one.

Fixes: 0e38b42bf61c ("vhost: manage FD with epoll")

Reported-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 lib/vhost/fd_man.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lib/vhost/fd_man.c b/lib/vhost/fd_man.c
index 87a8dc3f3e..9bc7e50b93 100644
--- a/lib/vhost/fd_man.c
+++ b/lib/vhost/fd_man.c
@@ -256,9 +256,14 @@ fdset_add(struct fdset *pfdset, int fd, fd_cb rcb, fd_cb wcb, void *dat)
 static void
 fdset_del_locked(struct fdset *pfdset, struct fdentry *pfdentry)
 {
-	if (epoll_ctl(pfdset->epfd, EPOLL_CTL_DEL, pfdentry->fd, NULL) == -1)
-		VHOST_FDMAN_LOG(ERR, "could not remove %d fd from %d epfd: %s",
-			pfdentry->fd, pfdset->epfd, strerror(errno));
+	if (epoll_ctl(pfdset->epfd, EPOLL_CTL_DEL, pfdentry->fd, NULL) == -1) {
+		if (errno == EBADF) /* File might have already been closed. */
+			VHOST_FDMAN_LOG(DEBUG, "could not remove %d fd from %d epfd: %s",
+				pfdentry->fd, pfdset->epfd, strerror(errno));
+		else
+			VHOST_FDMAN_LOG(ERR, "could not remove %d fd from %d epfd: %s",
+				pfdentry->fd, pfdset->epfd, strerror(errno));
+	}
 
 	fdset_remove_entry(pfdset, pfdentry);
 }
-- 
2.45.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] vhost: only emit debug log with invalid FD
  2024-06-24 14:46 [PATCH] vhost: only emit debug log with invalid FD Maxime Coquelin
@ 2024-06-25  7:35 ` David Marchand
  2024-06-25 11:47   ` Maxime Coquelin
  0 siblings, 1 reply; 3+ messages in thread
From: David Marchand @ 2024-06-25  7:35 UTC (permalink / raw)
  To: Maxime Coquelin; +Cc: dev, chenbox

On Mon, Jun 24, 2024 at 4:46 PM Maxime Coquelin
<maxime.coquelin@redhat.com> wrote:
>
> This patch improves the FD manager logging in case
> of FD removal from the epoll FD set failure.
>
> When the FD is not more valid, like for example if it

is not valid anymore*

> has already been closed, only emit a debug log and not
> an error one.
>
> Fixes: 0e38b42bf61c ("vhost: manage FD with epoll")
>
> Reported-by: David Marchand <david.marchand@redhat.com>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>

I tested with OVS dpdk-latest and the patch lgtm.
Reviewed-by: David Marchand <david.marchand@redhat.com>


-- 
David Marchand


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] vhost: only emit debug log with invalid FD
  2024-06-25  7:35 ` David Marchand
@ 2024-06-25 11:47   ` Maxime Coquelin
  0 siblings, 0 replies; 3+ messages in thread
From: Maxime Coquelin @ 2024-06-25 11:47 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, chenbox



On 6/25/24 09:35, David Marchand wrote:
> On Mon, Jun 24, 2024 at 4:46 PM Maxime Coquelin
> <maxime.coquelin@redhat.com> wrote:
>>
>> This patch improves the FD manager logging in case
>> of FD removal from the epoll FD set failure.
>>
>> When the FD is not more valid, like for example if it
> 
> is not valid anymore*
> 
>> has already been closed, only emit a debug log and not
>> an error one.
>>
>> Fixes: 0e38b42bf61c ("vhost: manage FD with epoll")
>>
>> Reported-by: David Marchand <david.marchand@redhat.com>
>> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> 
> I tested with OVS dpdk-latest and the patch lgtm.
> Reviewed-by: David Marchand <david.marchand@redhat.com>
> 
> 

Applied to next-virtio/for-next-net with commit message amended with
your suggestion.

Thanks,
Maxime


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-25 11:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-24 14:46 [PATCH] vhost: only emit debug log with invalid FD Maxime Coquelin
2024-06-25  7:35 ` David Marchand
2024-06-25 11:47   ` Maxime Coquelin

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).