From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7EC2D454E2; Mon, 24 Jun 2024 16:46:22 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 53F374065A; Mon, 24 Jun 2024 16:46:22 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 81A2140653 for ; Mon, 24 Jun 2024 16:46:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719240381; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RvD+6fRUV+GbJrNAzGQMa6VTam41skBosNye7By2r4A=; b=cPw9ywnkEay5+pX3mfRcPFP5Pliwd+1lsc9AOsHS7jwcYv4r/fbE26tPiiJ3gqjvNEn0iX MUyRFCcN8m9QHXlL9xbm6xU6oc1kr23ooSwXSrEMim7hYjvCSCdzAiRMqGjXsfUC/U+qQT MdEVfnycE3hwDz+z5z9TZ8cJ+6xe5Ro= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-244-5Zo80CCGOXm9FTqEVa0aQQ-1; Mon, 24 Jun 2024 10:46:19 -0400 X-MC-Unique: 5Zo80CCGOXm9FTqEVa0aQQ-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id AB6E8195606F; Mon, 24 Jun 2024 14:46:18 +0000 (UTC) Received: from max-p1.redhat.com (unknown [10.39.208.31]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BE82B1955E72; Mon, 24 Jun 2024 14:46:16 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, david.marchand@redhat.com, chenbox@nvidia.com Cc: Maxime Coquelin Subject: [PATCH] vhost: only emit debug log with invalid FD Date: Mon, 24 Jun 2024 16:46:13 +0200 Message-ID: <20240624144613.1855582-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 Signed-off-by: Maxime Coquelin --- 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