From nobody Sat May 4 05:21:14 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=1665641166; cv=none; d=zohomail.com; s=zohoarc; b=lHXJ7/xc8BoIImzQZe03Nplmpd7Q+jWsobXei/8Xu4SaOwlohZvwm64ERcAFwCSa2sprxznQwYMYp4ovN1h4ytUmbC357PdAlsA2SttpffHuzrLwPlFkajoezQg6+5AugDL3TwKxzWY41F6PQYNXN9Sofp9vzUWwyMLCfun63Aw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665641166; 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=3lNRQT/dOL85L2QxMJGPPpk6Y6hvt8fy82nufM1FLIg=; b=nRm075QZKJYMiOJKDkyoJGmIEA276lYoNnhOxZb0g284/rrtjKQ4H3PMIgbrPu9LynodOSK3BzPpefFQXUnUw0sE8mExf113iU9dAWx8SWdPhlb5MWBvOsUp9y39y/+IbXugad5bcuDfVIpPLieBx8anhZqjJLwf7OV4X62iUbE= 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 1665641166619896.0213885619937; Wed, 12 Oct 2022 23:06:06 -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-544-wO0fi2YSPfa3uK-tHFYKYg-1; Thu, 13 Oct 2022 02:05:58 -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 A85CA811E67; Thu, 13 Oct 2022 06:05:56 +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 036C5C15BB3; Thu, 13 Oct 2022 06:05:54 +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 C7D711946589; Thu, 13 Oct 2022 06:05:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id BDA001946588 for ; Thu, 13 Oct 2022 06:05:52 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 6A2FF2166BAD; Thu, 13 Oct 2022 06:05:52 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6344B2166BA9 for ; Thu, 13 Oct 2022 06:05:52 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.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 43FEB85A583 for ; Thu, 13 Oct 2022 06:05:52 +0000 (UTC) Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-561-3xzJsYPSPfivs8gEHIu9bQ-1; Thu, 13 Oct 2022 02:05:49 -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-1.canonical.com (Postfix) with ESMTPS id 834F33F0C8 for ; Thu, 13 Oct 2022 06:05:48 +0000 (UTC) Received: by mail-wm1-f72.google.com with SMTP id h206-20020a1c21d7000000b003c56437e529so323834wmh.2 for ; Wed, 12 Oct 2022 23:05:48 -0700 (PDT) Received: from localhost.localdomain ([2a02:6d40:3a4b:da00:d9f4:e62:f9fa:cf94]) by smtp.gmail.com with ESMTPSA id i5-20020a05600c290500b003c6d21a19a0sm3373413wmd.29.2022.10.12.23.05.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Oct 2022 23:05:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665641165; 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=3lNRQT/dOL85L2QxMJGPPpk6Y6hvt8fy82nufM1FLIg=; b=gfxpFbgWDIkQhgojBVENSWJNlm5/6bRrNKjl2f+blS0gmKrMnFmnx8iBmxsDoBLbaUWysp HNIjtWgE70a7E4cIa+rZps3ZDitj0pzABJcHshvichrCd4TJA2ym6kVvEX9Y75vygQloy0 HZmiQkSZeHes5CrJxzNX7T3UkTXfIIU= X-MC-Unique: wO0fi2YSPfa3uK-tHFYKYg-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: 3xzJsYPSPfivs8gEHIu9bQ-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=wOpZhlMHo2/vDVSqj9+VAPUPM3s1K6aNkQuzmlwR4OY=; b=paFrEQImmK0TIW1uBVO7wMs/qTxQxH9LmGc2t785AwKxhdtu41lIcX/LApvANuhvlq 8Ju2OcM8k8Ec/ln3/S2OW8B78DYiCag4y9U4N8lpKRbMvb4luPpkfDmIav86S23LYnip /F9nvuGzH8MivUzIrYu9+6GHPmz177Ai2kkmdMjNYLwxtXf9RJlLtU9JqoTz9eSgFHL9 fpbURx1w6r3idC1ruatZ4TQgWaNVbsNvAel7DteZBLI5DfxahBprrb28dZF47joMCBkN YHygcd/H8lOwTnqZxJiEx4A7oPhjepZhB8Jnj8D3gmI4EXRsizoAx0YZJXjnOOL51emR UdZg== X-Gm-Message-State: ACrzQf1bY9l9K8rWAdc4P1tqRN77iPfnPvXxs/Xi+YGyMIIOWjbC0kfm n9bhsJYHpNmuYFCVcdy3+kIkV+YKk9LRzn/VsAFW95buyvbx6aNlQvf7KF01UVgN0odfvqbE+hp /AsfAbfIMbl6fb/xQGwHi9lUh2FXia5Klbg== X-Received: by 2002:a05:6000:50a:b0:225:210c:a7e4 with SMTP id a10-20020a056000050a00b00225210ca7e4mr19969147wrf.704.1665641147856; Wed, 12 Oct 2022 23:05:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM41+AM4YGoDMFJfJTe35jCXOcSp+fK4/OL44u2FIoMBOPMN6KjvkUYWAppDHEmGiCyv9FpRWg== X-Received: by 2002:a05:6000:50a:b0:225:210c:a7e4 with SMTP id a10-20020a056000050a00b00225210ca7e4mr19969131wrf.704.1665641147624; Wed, 12 Oct 2022 23:05:47 -0700 (PDT) From: christian.ehrhardt@canonical.com To: libvir-list@redhat.com Subject: [PATCH] nodedev: ignore EINVAL from libudev in udevEventHandleThread Date: Thu, 13 Oct 2022 08:05:41 +0200 Message-Id: <20221013060541.2134443-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.6 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 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: 1665641167926100001 Content-Type: text/plain; charset="utf-8"; x-default="true" 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: #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