From nobody Thu May 15 12:54:19 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1508334808001977.3969372396685; Wed, 18 Oct 2017 06:53:28 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id F1C113DBC2; Wed, 18 Oct 2017 13:53:26 +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 D3AB66A515; Wed, 18 Oct 2017 13:53:26 +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 992D21800C99; Wed, 18 Oct 2017 13:53:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9IDrPYb009864 for ; Wed, 18 Oct 2017 09:53:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id C3CB69A249; Wed, 18 Oct 2017 13:53:25 +0000 (UTC) Received: from beluga.usersys.redhat.com (unknown [10.43.2.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9B17F9A240; Wed, 18 Oct 2017 13:53:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com F1C113DBC2 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Erik Skultety To: libvir-list@redhat.com Date: Wed, 18 Oct 2017 15:52:26 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Erik Skultety Subject: [libvirt] [PATCH v6 4/9] nodedev: udev: Remove driver locks from stateInitialize and stateCleanup 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 18 Oct 2017 13:53:27 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The driver locks are unnecessary here, since currently the cleanup is only called from the main daemon thread, so we can't race here. Moreover @devs and @privateData are self-lockable objects, so no problem there either. Signed-off-by: Erik Skultety --- src/node_device/node_device_udev.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index a7b628153..e0e5ba799 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1619,13 +1619,10 @@ nodeStateCleanup(void) if (!driver) return -1; =20 - nodeDeviceLock(); - virObjectUnref(driver->privateData); virObjectUnref(driver->nodeDeviceEventState); =20 virNodeDeviceObjListFree(driver->devs); - nodeDeviceUnlock(); virMutexDestroy(&driver->lock); VIR_FREE(driver); =20 @@ -1846,23 +1843,21 @@ nodeStateInitialize(bool privileged, return -1; } =20 - nodeDeviceLock(); - if (!(driver->devs =3D virNodeDeviceObjListNew()) || !(priv =3D udevEventDataNew())) - goto unlock; + goto cleanup; =20 driver->privateData =3D priv; driver->nodeDeviceEventState =3D virObjectEventStateNew(); =20 if (udevPCITranslateInit(privileged) < 0) - goto unlock; + goto cleanup; =20 udev =3D udev_new(); if (!udev) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("failed to create udev context")); - goto unlock; + goto cleanup; } #if HAVE_UDEV_LOGGING /* cast to get rid of missing-format-attribute warning */ @@ -1908,7 +1903,6 @@ nodeStateInitialize(bool privileged, goto unlock; =20 virObjectUnlock(priv); - nodeDeviceUnlock(); =20 /* Populate with known devices */ if (udevEnumerateDevices(udev) !=3D 0) @@ -1921,9 +1915,7 @@ nodeStateInitialize(bool privileged, return -1; =20 unlock: - if (priv) - virObjectUnlock(priv); - nodeDeviceUnlock(); + virObjectUnlock(priv); goto cleanup; } =20 --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list