From nobody Fri May 17 11:58:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1618329453; cv=none; d=zohomail.com; s=zohoarc; b=Mpi61+MzP8nVleUS2hNkCDauxaDJ32DKCAOFe/8ea7vY4OCK+32AvZWyv/HopZ9qBTWCS4USNvKJ/bxevO1ZBl3eHU/fUSCb/R1OBXjDMCJITmyGT7RG2nqwR2t1yOzSZvBm5Ysr8TYsRAaMB9rhwy9V5tytkK8JHXrMd2GYFhc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618329453; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=u7+IrVvQfjO+OGatlaK+TGyV6+qpSeEWo6T9E6B2Obc=; b=FsdL65P+nsVCD4jTYMxiwG+L7buHtuD3nDya0h3tCOL5raHrPJ/+d4FLcsMfNxCsZ9RjfSo8fTEkbLFcFzT/dbOC68HO/dh2twHgELdhln4w5+dssN+h49F0F9f5lqJZL8tRVLqb7Vb7gUZZnzLNDwFgBmPLJksHwE0oOK0PSr0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1618329453667428.98156218360157; Tue, 13 Apr 2021 08:57:33 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-563-ZdrpYeeWPLyOyFhnfKJlSg-1; Tue, 13 Apr 2021 11:57:29 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C7DB287A83B; Tue, 13 Apr 2021 15:57:23 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A96BA5D768; Tue, 13 Apr 2021 15:57:23 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6653F44A5E; Tue, 13 Apr 2021 15:57:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13DFvLAF014712 for ; Tue, 13 Apr 2021 11:57:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id 97C2A39A60; Tue, 13 Apr 2021 15:57:21 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C82D59456 for ; Tue, 13 Apr 2021 15:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618329452; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=u7+IrVvQfjO+OGatlaK+TGyV6+qpSeEWo6T9E6B2Obc=; b=QUHyqebBs0VDvmYnjWm0/XMzgz/Jws0sJjUwx6qN+RyNsOtFJuE7iGD7e1JrRFB/9XwfA4 P62M429DU9OzCoUtZM43dhf6AVJRBNWsXjpxXnBYTlWDokMkUOMfJYZFd53gg43dy8B3DO j9rIULqtcewKHjh8nlEL1W9Gf7mXC44= X-MC-Unique: ZdrpYeeWPLyOyFhnfKJlSg-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2 1/3] nodedev: Wait for device initialization in all public API callbacks Date: Tue, 13 Apr 2021 17:57:13 +0200 Message-Id: <713d1633d570e39324f4030d58be8ec5cef4ccc2.1618329176.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Although I have not experienced this in real life, there is a possible race condition when creating new device, getting its XML or parent or listing its capabilities. If the nodedev driver is still enumerating devices (in a separate thread) and one of virNodeDeviceGetXMLDesc(), virNodeDeviceGetParent(), virNodeDeviceNumOfCaps(), virNodeDeviceListCaps() or virNodeDeviceCreate() is called then it can lead to spurious results because the device enumeration thread is removing devices from or adding them to the internal list of devices (among with their states). Therefore, wait for things to settle down before proceeding with nodeDeviceCreate(). Signed-off-by: Michal Privoznik --- src/node_device/node_device_driver.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_de= vice_driver.c index 5f8995172d..7aee8201e8 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -340,6 +340,9 @@ nodeDeviceGetXMLDesc(virNodeDevicePtr device, =20 virCheckFlags(0, NULL); =20 + if (nodeDeviceInitWait() < 0) + return NULL; + if (!(obj =3D nodeDeviceObjFindByName(device->name))) return NULL; def =3D virNodeDeviceObjGetDef(obj); @@ -368,6 +371,9 @@ nodeDeviceGetParent(virNodeDevicePtr device) virNodeDeviceDef *def; char *ret =3D NULL; =20 + if (nodeDeviceInitWait() < 0) + return NULL; + if (!(obj =3D nodeDeviceObjFindByName(device->name))) return NULL; def =3D virNodeDeviceObjGetDef(obj); @@ -395,6 +401,9 @@ nodeDeviceNumOfCaps(virNodeDevicePtr device) virNodeDeviceDef *def; int ret =3D -1; =20 + if (nodeDeviceInitWait() < 0) + return -1; + if (!(obj =3D nodeDeviceObjFindByName(device->name))) return -1; def =3D virNodeDeviceObjGetDef(obj); @@ -423,6 +432,9 @@ nodeDeviceListCaps(virNodeDevicePtr device, int ret =3D -1; size_t i =3D 0; =20 + if (nodeDeviceInitWait() < 0) + return -1; + if (!(obj =3D nodeDeviceObjFindByName(device->name))) return -1; def =3D virNodeDeviceObjGetDef(obj); @@ -1399,6 +1411,9 @@ nodeDeviceCreate(virNodeDevice *device, =20 virCheckFlags(0, -1); =20 + if (nodeDeviceInitWait() < 0) + return -1; + if (!(obj =3D nodeDeviceObjFindByName(device->name))) return -1; =20 --=20 2.26.3 From nobody Fri May 17 11:58:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1618329457; cv=none; d=zohomail.com; s=zohoarc; b=ZyOZtHa+ngAlLuBmxP5cVVr/pEe2eGiUFXUtgIKxxYFwF/A3uD76OYbmVk0+kCfem4N9TZW024ZyeAPLQFPv4MEyvc2gizTI9qRjbBFUAX10FOAPAl3soNUHmNeMXKY+Q1g+Gy5/lrbiKKARO+AveWBBWZBfPCHUvfydCQ/kfqA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618329457; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LGyj2q24au4Y+KXB1ZoN2hOJHYsLIY+YEZKfShg8Wog=; b=PbmNa8RsW3meEdx3pmX+r7I6CMxFotqYdEHKOfp+i2EIbo2z+w75CT73y8VQcdWTAbRX/+kzEPMvRUfqLm72+c8AWMHwlvUAnaYEMsEVQ4lJ/nLoh71/7j6/DHaXUlEwb9zhXmAvvDKEjJhA8hmHW1gcNbQZcrkuXIJotQIDd34= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1618329457265789.1996028071968; Tue, 13 Apr 2021 08:57:37 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-311-A3X0qb_MPwKsDtIdPGAUaQ-1; Tue, 13 Apr 2021 11:57:33 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 143B21020C22; Tue, 13 Apr 2021 15:57:28 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E5C5D5C26D; Tue, 13 Apr 2021 15:57:27 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B16C11806D15; Tue, 13 Apr 2021 15:57:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13DFvMAw014723 for ; Tue, 13 Apr 2021 11:57:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6EA7E39A60; Tue, 13 Apr 2021 15:57:22 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id E83E56062F for ; Tue, 13 Apr 2021 15:57:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618329456; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=LGyj2q24au4Y+KXB1ZoN2hOJHYsLIY+YEZKfShg8Wog=; b=evI7HZDnUlr3sS3UQuSS9StaeZjvf7CUDhx6FeGGUEvN/cS5w1R7WDkymj2YCcPauq71Yo ExpiPlRq2zglioeM+FrjWAaUGjcc2Nhj7IOH+rFfEV92wZKVHkwnLhUOqKQfmIxWnz2kmL YZfzhzH9wJCsl02F00qGiBqOvUypRs8= X-MC-Unique: A3X0qb_MPwKsDtIdPGAUaQ-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2 2/3] nodedev: Mark device initialization complete even in case of an error Date: Tue, 13 Apr 2021 17:57:14 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" To speed up nodedev driver initialization, the device enumeration is done in a separate thread. Once finished, the thread sets a boolean variable that allows public APIs to be called (instead of waiting for the thread to finish). However, if there's an error in the device enumeration thread then the control jumps over at the 'error' label and the boolean is never set. This means, that any virNodeDev*() API is stuck forever. Mark the initialization as complete (the thread is quitting anyway) and let the APIs proceed. Signed-off-by: Michal Privoznik Reviewed-by: Erik Skultety --- src/node_device/node_device_udev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index 84785d9e1e..658170a767 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1982,6 +1982,7 @@ nodeStateInitializeEnumerate(void *opaque) if (nodeDeviceUpdateMediatedDevices() !=3D 0) goto error; =20 + cleanup: nodeDeviceLock(); driver->initialized =3D true; virCondBroadcast(&driver->initCond); @@ -1996,6 +1997,8 @@ nodeStateInitializeEnumerate(void *opaque) priv->threadQuit =3D true; virCondSignal(&priv->threadCond); virObjectUnlock(priv); + + goto cleanup; } =20 =20 --=20 2.26.3 From nobody Fri May 17 11:58:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1618329457; cv=none; d=zohomail.com; s=zohoarc; b=QTyJF28LeHkbI/EmJMBZjIm8ukrDmOIQoAEDWGI8rZke8s0vUQKcC5xi+KLtrA4EJRQ/JOSDuJBHzpO57gFY4K6Kl2kxDvhPCCBbqT/DWVSH/t3DnmKDjEKcWjn4aMqtumzL769JZda4Gq6cn6iCGCUuaL+LMLBoF7t/1MaEhts= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618329457; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/PySOEjYSCvEM7BzVDmzQK8TKjIz3M5FtybgdVsdeSY=; b=cLjJADoCstpHHGFVi7H30x+PrZgzMJ55L9joJI8VV9NcO+uUP5480w/gdQGhW20WuSxN0KM8GmL+T8ohOCYOgZunfLi5Z9tp2Rs6my+OE/09YfAdz9y7vdaGVOZ3cXZp39NdwA6YYuKcC3Z5E/Nq7rUYB6Mq36QINx/I1P5HxtQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1618329457777631.4959737212705; Tue, 13 Apr 2021 08:57:37 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-87-c3_lMp0QNNOyWu9xUTBLCQ-1; Tue, 13 Apr 2021 11:57:33 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1970F802575; Tue, 13 Apr 2021 15:57:28 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E9C87610A8; Tue, 13 Apr 2021 15:57:27 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B329F44A67; Tue, 13 Apr 2021 15:57:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13DFvNak014732 for ; Tue, 13 Apr 2021 11:57:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 45CFF39A60; Tue, 13 Apr 2021 15:57:23 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id BEBBF6062F for ; Tue, 13 Apr 2021 15:57:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618329456; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=/PySOEjYSCvEM7BzVDmzQK8TKjIz3M5FtybgdVsdeSY=; b=M5cvHo+cJTYALOyTeQIkeOrKwKajoaSYX9cqZ31BHuHDVsyL27kM4+MeBADVAB062BKSRN BQkG/TTYr3nhFcdHo2+NCDSHI0IcPP/EGv0dqmiTjZHBc3n2phZBYeWRJToic8wNQijFDj 4Tgnv2sMt36BvTFmO8Kbki1TXe8d24o= X-MC-Unique: c3_lMp0QNNOyWu9xUTBLCQ-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2 3/3] nodedev: Don't fail device enumeration if MDEVCTL is missing Date: Tue, 13 Apr 2021 17:57:15 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" After all devices were enumerated, the enumeration thread call nodeDeviceUpdateMediatedDevices() to refresh the state of mediated devices. This means that 'mdevctl' will be executed. But it may be missing on some systems (e.g. mine) in which case we should just skip the update of mdevs instead of failing whole device enumeration. Signed-off-by: Michal Privoznik Reviewed-by: Erik Skultety --- src/node_device/node_device_driver.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_de= vice_driver.c index 7aee8201e8..180d9da529 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -42,9 +42,12 @@ #include "virnetdev.h" #include "virutil.h" #include "vircommand.h" +#include "virlog.h" =20 #define VIR_FROM_THIS VIR_FROM_NODEDEV =20 +VIR_LOG_INIT("node_device.node_device_driver"); + virNodeDeviceDriverState *driver; =20 virDrvOpenStatus @@ -1604,9 +1607,15 @@ nodeDeviceUpdateMediatedDevices(void) { g_autofree virNodeDeviceDef **defs =3D NULL; g_autofree char *errmsg =3D NULL; + g_autofree char *mdevctl =3D NULL; virMdevctlForEachData data =3D { 0, }; size_t i; =20 + if (!(mdevctl =3D virFindFileInPath(MDEVCTL))) { + VIR_DEBUG(MDEVCTL " not found. Skipping update of mediated devices= ."); + return 0; + } + if ((data.ndefs =3D virMdevctlListDefined(&defs, &errmsg)) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("failed to query mdevs from mdevctl: %s"), errmsg= ); --=20 2.26.3