From nobody Wed Apr 24 08:14:46 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=1668073009; cv=none; d=zohomail.com; s=zohoarc; b=dt8owCNAzdfUPgBm/imKJJB7YOA+P2GuJEvNPU1muzRGiTK30Osh8RAFskXWWkjq4v4V7PaXBtVzAlk8iGXaUJMOwqaGQaClgeloX+4B8Qr9ATGToi3kVYenFS6J/5J4V+fLYT7VElxwdmurTngKEuE0SyG78Jwei4/iE5A1nVQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1668073009; 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=MrwADWOb3IR6SpyXB8se6p82E5nrlJpML7QbXLG+ulk=; b=hHkor36p/a0hANXRTBcehQ16GVjJuSp6eC1G9rIeoYc/b6BkslnxrcovNk8+eDls1eLBSgD0XZc/9ht4zKUhRbcH8/vu5MV+LsQDM2rzjozeNm+IBAIx7p/knre8pRU9eyL9KaAD8jH6c9QZMXGWcT1ZjFMYIo95E9TBmcUZo/I= 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 1668073009714917.5844783347264; Thu, 10 Nov 2022 01:36:49 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-642-9jCaTFEMMeqTeDnY6NjHUA-1; Thu, 10 Nov 2022 04:36:47 -0500 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 019DB38173CE; Thu, 10 Nov 2022 09:36:45 +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 2CF842166B29; Thu, 10 Nov 2022 09:36:44 +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 08CB919465B2; Thu, 10 Nov 2022 09:36:44 +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 887C81946597 for ; Thu, 10 Nov 2022 09:36:42 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 6D168492B1D; Thu, 10 Nov 2022 09:36:42 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 65A56492B1B for ; Thu, 10 Nov 2022 09:36:42 +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 47B5C811E75 for ; Thu, 10 Nov 2022 09:36:42 +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-428-FcMjg96RPR-N03AGtN6Ocg-1; Thu, 10 Nov 2022 04:36:39 -0500 Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) (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 68ABE423E0 for ; Thu, 10 Nov 2022 09:36:36 +0000 (UTC) Received: by mail-ej1-f69.google.com with SMTP id nc4-20020a1709071c0400b0078a5ceb571bso860998ejc.4 for ; Thu, 10 Nov 2022 01:36:36 -0800 (PST) Received: from localhost.localdomain ([2a02:6d40:39af:c100:edc3:c4e4:e63f:8ae8]) by smtp.gmail.com with ESMTPSA id p11-20020a05640210cb00b004637489cf08sm8185948edu.88.2022.11.10.01.36.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 01:36:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668073008; 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=MrwADWOb3IR6SpyXB8se6p82E5nrlJpML7QbXLG+ulk=; b=MvlAhhBHIvN4ijo2LIxLwylNxDHKNzjfODEkS4xqatZpbyjs1huF7+z3rcYG0MwHZhdL6H prgEzhZs3nU8yP7Kdv13FUvnJZicyCPlPMQFNFKgMbJprTSfoAM+1FMCRYuEXxm9GbOp99 vhu+wV5AAEcfXSHhMx7ty2cr13lbSRQ= X-MC-Unique: 9jCaTFEMMeqTeDnY6NjHUA-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: FcMjg96RPR-N03AGtN6Ocg-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=GX0xBviOiE0cJvMoeGQoezOkLaBhWC0zamMoyBARApU=; b=0GgoPC/FVDwxVALwtH9dBTmI5wW9nNQq/vkv5TR3ykGcD6X1vDABKFKnuKey9kgRq4 i6wJoFwGMkJCD53m9vyqCu0UcdV1ZYcuOT1TcZyHp8XplGWYO93J2XYFoHAAzOCvvjRz wJ+WKBVoOqppb8IQAyCpy/c4CWEbIdlthNNejp+DntwFhuE+qwyRgBCKpalgoxhfxrKe vVVLXj6p1HCG4BMkBmJjmr9hYgf76GKdO35F0XfQ3FFAYybFCaWQuHJe53+dGcCmWXgC xzoz3dAUiOmV0gk0bsL9+TDhhViUz90SD0fs+DZQKnaM78doSLbDsbOY3l2msOEM9HOY BoGw== X-Gm-Message-State: ACrzQf02O/uyQ3QbrGofwlrR+AIrOlJzFbFmS/rJrefGP565jbHdyazv sj9rl0rfX4s0clI+h6LIGUMHfg8rZm9WtRODvptT9u/ottniK+errisiaNq1Ipn623TqG3x4ISK 58C8z907YV8oK0XDM2cQTjhn0mIe45ERxHw== X-Received: by 2002:a17:906:ad81:b0:7ad:d411:30af with SMTP id la1-20020a170906ad8100b007add41130afmr2496220ejb.636.1668072994544; Thu, 10 Nov 2022 01:36:34 -0800 (PST) X-Google-Smtp-Source: AMsMyM7Gw6Xsk6M1ONU5cpfnMv9M/RnIlU+WVgL5F6lhOXUnqWbjZ8zSgFLca2cGd5vNtFGyOiRVNQ== X-Received: by 2002:a17:906:ad81:b0:7ad:d411:30af with SMTP id la1-20020a170906ad8100b007add41130afmr2496214ejb.636.1668072994312; Thu, 10 Nov 2022 01:36:34 -0800 (PST) From: christian.ehrhardt@canonical.com To: libvir-list@redhat.com Subject: [PATCH v3] nodedev: ignore EINVAL from libudev in udevEventHandleThread Date: Thu, 10 Nov 2022 10:36:28 +0100 Message-Id: <20221110093628.777913-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: 1668073012182100001 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 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. The root cause is in systemd and by now was discussed and fixed via https://github.com/systemd/systemd/issues/24987, but hardening libvirt to be able to better deal with EINVAL returned still is the right thing to avoid the reported busy loops on systemd with older systemd versions. 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 24ef1c25a9..2454cab8f8 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1865,10 +1865,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.1