From nobody Sat May 18 23:55:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1665659378; cv=none; d=zohomail.com; s=zohoarc; b=PozcrX0ep3dI1Y7yHLYGvwkQJoShi6M48iEzzyqlAEYdlpWfXNq3Axw60GWwFBNoBxCpPO3zvuY6H8r/uDPQlzIwrvEAnmdFxXcCYd8+yZyi84ZTQchtYN5IX/NGUGQrvXgOzuDb9MJHcuMJpDBamyAo4tKVp67m+Qiug91mkds= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665659378; 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=IEFfIVtXAs2fCdcakbHjhHjLVJMv60Tmip/YpqqEXCM=; b=GJOHsWBDNWbaG2gfJM9nGnJUYJrtOWorPcpjEIwA6LIh6IcaK1uaPiyPCtN5dOsSSZnyD5gaqct+9oJiwmP33b2D1h2lZqcLEfHLiXzLX0fIqyG5OGbDWC/KP9kTOspe/nrWdlnCyZ7+eMnTUMA/tSpEiQuKvaA0JCxtCCyq/nU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1665659378140757.2529113636705; Thu, 13 Oct 2022 04:09:38 -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-381-bQAortFVNya0T0fxDzxsnQ-1; Thu, 13 Oct 2022 07:09:32 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8E85C185A7A8; Thu, 13 Oct 2022 11:09:30 +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 79D76C2C8DD; Thu, 13 Oct 2022 11:09:30 +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 4E00C1946594; Thu, 13 Oct 2022 11:09:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id BE1BB1946588 for ; Thu, 13 Oct 2022 11:09:28 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 9B763C15E76; Thu, 13 Oct 2022 11:09:28 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast07.extmail.prod.ext.rdu2.redhat.com [10.11.55.23]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 933E5C2E09B for ; Thu, 13 Oct 2022 11:09:28 +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 6DE6F3C0E212 for ; Thu, 13 Oct 2022 11:09:28 +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-640-tjZKQpEyPMmLpiJtlJ-sEw-1; Thu, 13 Oct 2022 07:09:26 -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 D094A3F462 for ; Thu, 13 Oct 2022 11:09:25 +0000 (UTC) Received: by mail-wm1-f72.google.com with SMTP id f26-20020a7bcc1a000000b003c03db14864so672695wmh.6 for ; Thu, 13 Oct 2022 04:09:25 -0700 (PDT) Received: from localhost.localdomain ([2a02:6d40:3a4b:da00:d9f4:e62:f9fa:cf94]) by smtp.gmail.com with ESMTPSA id k13-20020a05600c0b4d00b003bf3fe1d0c4sm4112276wmr.22.2022.10.13.04.09.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Oct 2022 04:09:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665659376; 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=IEFfIVtXAs2fCdcakbHjhHjLVJMv60Tmip/YpqqEXCM=; b=cb25zeL0/WmZ8AXNyGJrmEXWxA+zsxHXvhfN8BE657NoN7nhFeBowc+n+HS4aMZI3Rab44 1GQloVfIQrMPSgs9F5vU/A11dEJiJXi/wFHmFwUf+Y8kpas4DFgrUqxgd1uUGJ5C6zpB8F mz7an+iQjrkVer+hfU8CddLZN+qGMkA= X-MC-Unique: bQAortFVNya0T0fxDzxsnQ-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: tjZKQpEyPMmLpiJtlJ-sEw-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=+4KtS0Gzz7EDri4xU3+Y0tfwBYJ3n1LBmpQel0z7bTM=; b=ucFXve+nS1zBk+DhA4PpEEi71845TARIkiSQNMYHQqv0ngeEibyBGGHjuQk0h+LZ2A Zpm+cP+Bd77+wSiKQb3R0j1ec0mraasQB6xUgVC8aoT5yK15rc6M79jat/55ChkRqMi9 mMNtUIMXL3Ytf+mSH9nxap7BtllH3R3LD6Jsxg/JoFTKJVfxefQ8AV4htaXiSTBywkwb E8MbnoYobikRhIAnQgQZ80i+haMCyZGSoTXm1ERTOTu/Dz4/K+y3SHElHNXIOvJy6yn3 uov+u9BdoheyjugxShMJEdAO7aRMm/ckfW2OrwBHf7z+nO1dYQOPzoKLQdQtKUn81TkL /sgA== X-Gm-Message-State: ACrzQf2UB+M7nr6WwnGjaUqj1exWNTczBZsW4WTk9aIjgeNCSSXve98G fnHeuRGGzaSb32tz+MPbE6EvXqAKwYFk9OvzGKXaDxFcUEN7lUFAulC/pTy0rdf7KYZ2au7WY2v lDMNoyOzxluGTHb7+urlxgvq1F8z5ul9yaw== X-Received: by 2002:a05:6000:1cf:b0:22e:3ef1:a268 with SMTP id t15-20020a05600001cf00b0022e3ef1a268mr20960692wrx.43.1665659365098; Thu, 13 Oct 2022 04:09:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ZulgliFIENcBumwRsj07BFNBHZLZE5iLoSnFfRsMU3MxjU2xkTnfZ8sMWQuqZ+iMSWkQtug== X-Received: by 2002:a05:6000:1cf:b0:22e:3ef1:a268 with SMTP id t15-20020a05600001cf00b0022e3ef1a268mr20960672wrx.43.1665659364876; Thu, 13 Oct 2022 04:09:24 -0700 (PDT) From: christian.ehrhardt@canonical.com To: libvir-list@redhat.com Subject: [PATCH v3] nodedev: ignore EINVAL from libudev in udevEventHandleThread Date: Thu, 13 Oct 2022 13:09:19 +0200 Message-Id: <20221013110919.2280222-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.8 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.8 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: 1665659379709100001 Content-Type: text/plain; charset="utf-8" From: Christian Ehrhardt Certain 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 Signed-off-by: Christian Ehrhardt --- 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