From nobody Sat May 4 05:15:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=canonical.com ARC-Seal: i=1; a=rsa-sha256; t=1665659277; cv=none; d=zohomail.com; s=zohoarc; b=G+E6yyZuAUYCpatddUymfxVCB8XxQRgB3Pvju4M21L7PGYEoZMY4NmaFxTood/iaomJ0or1fQonIEfq3WNDVz+pdlLWlny5I2BxZ9bX+KVZJIIxv3ovY535P0nVFGGEnursE+/Iy08uN4xcpSpVTj4W/yxFxPDZIb/7mAhW60DA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665659277; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=gjjrbXx4WLEAMxJ2DC7lGJSNK+Nh6LrnqpkPSYV9dN4=; b=mgZVduOQUm6qoLrUmRqalPH8QOGsE7y0MyhSF4BNkx2War80ptpRzZ1BglQgOw20kBem5YTe0smEAp+6rJaBnN4Q3kLEwUBCgW1mV4QZXeZFXOGTGupMONcz/TNPg19eSTFJOkR3Wz1XbFyFUnoCVVEoRVeBuWRIIw5IgWTSN9w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1665659277433282.61739878001674; Thu, 13 Oct 2022 04:07:57 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-198-OfA26jU7NCqgNss__QleKw-1; Thu, 13 Oct 2022 07:07:51 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7F8E08582B9; Thu, 13 Oct 2022 11:07:49 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0AD1C2166BA3; Thu, 13 Oct 2022 11:07:49 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D84171946594; Thu, 13 Oct 2022 11:07:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 30D091946588 for ; Thu, 13 Oct 2022 11:07:47 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 0CAA2492B10; Thu, 13 Oct 2022 11:07:47 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast08.extmail.prod.ext.rdu2.redhat.com [10.11.55.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0543F492B05 for ; Thu, 13 Oct 2022 11:07:46 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DBC8E3811F32 for ; Thu, 13 Oct 2022 11:07:41 +0000 (UTC) Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-358-btq4ACrpNc-D-XBkFfns3Q-1; Thu, 13 Oct 2022 07:07:35 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (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 smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id ECC363F486 for ; Thu, 13 Oct 2022 11:07:33 +0000 (UTC) Received: by mail-wm1-f72.google.com with SMTP id l15-20020a05600c4f0f00b003b4bec80edbso970007wmq.9 for ; Thu, 13 Oct 2022 04:07:33 -0700 (PDT) Received: from localhost.localdomain ([2a02:6d40:3a4b:da00:d9f4:e62:f9fa:cf94]) by smtp.gmail.com with ESMTPSA id h14-20020a05600c2cae00b003b47e8a5d22sm4471618wmc.23.2022.10.13.04.07.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Oct 2022 04:07:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665659274; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=gjjrbXx4WLEAMxJ2DC7lGJSNK+Nh6LrnqpkPSYV9dN4=; b=UmGYniu0MEgAtFOPqvuFVloY4375itMECznzD6EphTAyOLPVefAHwsERUK62MEYsOCmVDz izaDYGFip05r4xe9S/V5kViWzdkyR9NmaejOC9vC/2KqrpyT4qXuQL44YXSiONnVvqQuCW QsdTAO1f1H0TMg6Wl2yWfZFFYk+PjJ4= X-MC-Unique: OfA26jU7NCqgNss__QleKw-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: btq4ACrpNc-D-XBkFfns3Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=w/6p+0m9VONxOz26Yo2IUr8u6IPC84BsEqFNIf2ka54=; b=AM5y34ROUPstJ/9NqOuu+LeuEKg+qUKtJsTFgacMqRcKWp7mt9L7Oycjb4CNoz3Ajv MbpfgKIKf4hAjdklcI4L7My5xDsw5+TJswbwCxKv98qgepjiuSJBhPMae+bWZ26qAx+2 24j9UfrqbVFs6oGq/wV0J7vL07Tse1WNQTjN1AbKL/eq790yf6VkdhpvMnrm8cNipOe1 WigrKfyDr3TgwFFYJpRtBAHFVrfHptU6/G9ppeskLXf8YvFlEnaZE2uw3fzi7l0hu5nh 8Obb7ISPE5+2WolkgKx0dGZwgrUBaxLchWMzWENFkUZK6bAmeM0TckJkJyalD8wMSMHQ sBCQ== X-Gm-Message-State: ACrzQf053tZFMmFmHgue4bPw/m+N4w3Yv8KXtv/WPhUvj4Cq0COfzaZA Kt6K9y2zYTi0uOArp58KZk9JFJazK2BfRPlKmoz68EhB+QrHtVZRaf1fFefYrTidOiSzJBJqoMs lUfDC55j0Ge7xHNhpGe0DhtUN4KbBPY2xKw== X-Received: by 2002:a05:6000:1864:b0:22e:5e05:b1f7 with SMTP id d4-20020a056000186400b0022e5e05b1f7mr20629912wri.226.1665659252873; Thu, 13 Oct 2022 04:07:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ZrdD9QmDernJNMaVwYhE+PTSt6ab/wLTyTeSSye4zy/1MH06UCzGGFDtbVcPlqzOS3q9oeA== X-Received: by 2002:a05:6000:1864:b0:22e:5e05:b1f7 with SMTP id d4-20020a056000186400b0022e5e05b1f7mr20629891wri.226.1665659252463; Thu, 13 Oct 2022 04:07:32 -0700 (PDT) From: christian.ehrhardt@canonical.com To: libvir-list@redhat.com Subject: [PATCH v2] nodedev: ignore EINVAL from libudev in udevEventHandleThread Date: Thu, 13 Oct 2022 13:07:26 +0200 Message-Id: <20221013110726.2270459-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Christian Ehrhardt , Erik Skultety Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665659279441100001 Content-Type: text/plain; charset="utf-8" From: Christian Ehrhardt Certiain udev entries might be of a size that makes libudev emit EINVAL which right now leads to udevEventHandleThread exiting. Due to no more handling events other elements of libvirt will start pushing for events to be consumed which never happens causing a busy loop burning a cpu without any gain. After evaluation of the root cause of the example case discussed in in #245 and a test run ignoring EINVAL it was considered safe to add EINVAL to the ignored errnos to not exit udevEventHandleThread giving it more resilience. Fixes: https://gitlab.com/libvirt/libvirt/-/issues/245 Signed-off-by: Christian Ehrhardt Reviewed-by: Daniel P. Berrang=C3=A9 --- src/node_device/node_device_udev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index 07c10f0d88..21fbcc2dca 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1863,10 +1863,12 @@ udevEventHandleThread(void *opaque G_GNUC_UNUSED) } =20 /* POSIX allows both EAGAIN and EWOULDBLOCK to be used - * interchangeably when the read would block or timeout was fi= red + * interchangeably when the read would block or timeout was fi= red. + * EINVAL might happen on too large udev entries, ignore those= for + * the robustness of udevEventHandleThread. */ VIR_WARNINGS_NO_WLOGICALOP_EQUAL_EXPR - if (errno !=3D EAGAIN && errno !=3D EWOULDBLOCK) { + if (errno !=3D EAGAIN && errno !=3D EWOULDBLOCK && errno !=3D = EINVAL) { VIR_WARNINGS_RESET virReportSystemError(errno, "%s", _("failed to receive device from udev= " --=20 2.38.0