From nobody Thu May 16 08:28:05 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1661276593; cv=none; d=zohomail.com; s=zohoarc; b=aX7hU7deWLKDpcmJU6h408K4Kk8R2PnP/a8FdGGYydfBmIT4gYPmbR/howEzXKob9bPZzRYPnx39OQ71h1NUiq4FKx7Hn/8KbPK0ObOffNF7T8HOJG7GtI3aJ91e0d7itSdsRU2skApAO99uJFmP2Aog8QyMfD160h9I1GXGrs4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1661276593; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=DlqxOz+MrOGfTnPF90lQRPPDkOhrLT59w3XE/TLIbmI=; b=njwB8Dd8sjhkUR5e+gC27ZeRewRymEr3LXEmPJnZgsX5akzWtfc7Jppm8Qgbo5tMzKvVan0mnFczK9uWu5LoVqUoaEyLxoL2GUMXgRyQ1SafmTAIZTd5uKNjS3VymiScPdvJEoDrGMX5reLdoloeWyTnwyU9/Agtv9Gg38VHGsg= 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=pass 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 1661276593829456.3387595605386; Tue, 23 Aug 2022 10:43:13 -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-328-TL1bWOH2PcetDKWWJteflA-1; Tue, 23 Aug 2022 13:43:09 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C90CD811E87; Tue, 23 Aug 2022 17:43:07 +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 03ED0403351; Tue, 23 Aug 2022 17:43:06 +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 CD1341946A47; Tue, 23 Aug 2022 17:43:05 +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 E9AAC1946A40 for ; Tue, 23 Aug 2022 17:43:03 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id DA1902166B29; Tue, 23 Aug 2022 17:43:03 +0000 (UTC) Received: from himantopus.redhat.com (unknown [10.22.11.126]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BC67C2166B26 for ; Tue, 23 Aug 2022 17:43:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661276592; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=DlqxOz+MrOGfTnPF90lQRPPDkOhrLT59w3XE/TLIbmI=; b=bAe8NvkwSWtMXnEPSaSnMCGWdk3MJ04VTRWZkdpm9o+E9P1Ockluiit3VBlCMb1B1qWIYy jLZmWh57a8ifeFZTGfrfKsY63Xe8epBj/ws9bhH3BZht8/3G01i9u7DZxIi8E5reqOZyXC oO8T2sc5Ynj2tvsyUiBHXLk3jRk2cwY= X-MC-Unique: TL1bWOH2PcetDKWWJteflA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH] nodedev: wait a bit longer for new node devices Date: Tue, 23 Aug 2022 12:43:03 -0500 Message-Id: <20220823174303.3218330-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 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: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 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: 1661276594996100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Openstack developers reported that newly-created mdevs were not recognized by libvirt until after a libvirt daemon restart. The source of the problem appears to be that when libvirt gets the udev 'add' event, the sysfs tree for that device might not be ready and so libvirt waits 100ms for it to appear (max 100 waits of 1ms each). But in the OpenStack environment, the sysfs tree for new mediated devices was taking closer to 250ms to appear and therefore libvirt gave up waiting and didn't add these new devices to its list of nodedevs. By changing the wait time to 1 second (max 100 waits of 10ms each), this should provide enough time to enable these deployments to recognize newly-created mediated devices, but it shouldn't increase the delay for more traditional deployments too much. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2109450 Signed-off-by: Jonathon Jongsma Reviewed-by: Erik Skultety --- Alternatively, we could switch to triggering off of the udev 'bind' event rather than the 'add' event, but I wasn't able to convince myself that this would result in 100% compatible behavior, so this felt like the safest solution. If others can convince me that switching to 'bind' is safe, I can re-submit this patch. src/node_device/node_device_udev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index e76c1a36b8..a06eaade5d 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1058,7 +1058,7 @@ udevProcessMediatedDevice(struct udev_device *dev, =20 linkpath =3D g_strdup_printf("%s/mdev_type", udev_device_get_syspath(d= ev)); =20 - if (virFileWaitForExists(linkpath, 1, 100) < 0) { + if (virFileWaitForExists(linkpath, 10, 100) < 0) { virReportSystemError(errno, _("failed to wait for file '%s' to appear"), linkpath); --=20 2.37.1