From nobody Mon Feb 9 15:30:03 2026 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=1645103048; cv=none; d=zohomail.com; s=zohoarc; b=STnq5JdsFvDBx3IfAefeCBNNjRDrVT1QnR6uzn49dTRdYyVck4qOv6FlYCGh4oJZsYwJATziZ1FD+TPDzDIrW10kbqktPOKp/a6gTppsT9b5uNFXdeXwfs6s3SHlsGFw4ABNXR0SW/uYEg1lkjeyUIbPhviCPDzM4vFzdkw+ZPM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1645103048; h=Content-Type:Content-Transfer-Encoding:Cc: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=CsLka36hPUVi1OMUhNnDmAfHMNWY2HkUCDcudOcGI5E=; b=Yu6mGS0pl5E0qGUlzdD/SdvsJzEhnluVZQx65pDiwWj7SoCp0Upx/sobeXHbkHMV+TbIwFmZbbH90t1l9CEJl0ch7ZZ7xYBqN9a/XHBcYNiujBIr8/PBh9zzu8sI6v5KUufV4xYS4/SMpTxA6noiEvip4zQMpiy5eUfEGxY7zVI= 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 1645103048879779.6575617191816; Thu, 17 Feb 2022 05:04:08 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-492-cULBX2pWMQ-dfq54Y7sj7Q-1; Thu, 17 Feb 2022 08:04:05 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A47A2814249; Thu, 17 Feb 2022 13:03:59 +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 84389108F83A; Thu, 17 Feb 2022 13:03:59 +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 2D5E51832AD6; Thu, 17 Feb 2022 13:03:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 21HD1F98031256 for ; Thu, 17 Feb 2022 08:01:15 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4B6082B3DD; Thu, 17 Feb 2022 13:01:15 +0000 (UTC) Received: from work.speedport.ip (unknown [10.39.194.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 90D2E2B3A7; Thu, 17 Feb 2022 13:01:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645103047; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=CsLka36hPUVi1OMUhNnDmAfHMNWY2HkUCDcudOcGI5E=; b=dQbjTaj3+y0CwviZzRhOcm91lZJZ9ZgzgPPzgYNkWO8wOovA01apBiK4w8TncBNhsHcoSl JEJAVK4xboFe5oUZgeL2Ui8r5ewXel3BOav8rs1/uvoFVgck6EWLb22Wa2OjLhNo6OMzpE JHzyStpDBeqk7Jxfv/0CdJF0yRt1ugM= X-MC-Unique: cULBX2pWMQ-dfq54Y7sj7Q-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 09/11] storage: Statically initialize mutex Date: Thu, 17 Feb 2022 14:01:01 +0100 Message-Id: <20220217130103.18543-10-twiederh@redhat.com> In-Reply-To: <20220217130103.18543-1-twiederh@redhat.com> References: <20220217130103.18543-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.84 on 10.5.11.22 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) X-ZM-MESSAGEID: 1645103053981100007 Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake --- src/conf/virstorageobj.h | 2 -- src/storage/storage_driver.c | 11 ++++------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/conf/virstorageobj.h b/src/conf/virstorageobj.h index 523bdec244..ad6005f153 100644 --- a/src/conf/virstorageobj.h +++ b/src/conf/virstorageobj.h @@ -31,8 +31,6 @@ typedef struct _virStoragePoolObjList virStoragePoolObjLi= st; =20 typedef struct _virStorageDriverState virStorageDriverState; struct _virStorageDriverState { - virMutex lock; - /* pid file FD, ensures two copies of the driver can't use the same ro= ot */ int lockFD; =20 diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 97e0d9b3a0..05675a5539 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -57,6 +57,8 @@ VIR_LOG_INIT("storage.storage_driver"); =20 static virStorageDriverState *driver; =20 +static virMutex mutex =3D VIR_MUTEX_INITIALIZER; + static int storageStateCleanup(void); =20 typedef struct _virStorageVolStreamInfo virStorageVolStreamInfo; @@ -67,11 +69,11 @@ struct _virStorageVolStreamInfo { =20 static void storageDriverLock(void) { - virMutexLock(&driver->lock); + virMutexLock(&mutex); } static void storageDriverUnlock(void) { - virMutexUnlock(&driver->lock); + virMutexUnlock(&mutex); } =20 =20 @@ -270,10 +272,6 @@ storageStateInitialize(bool privileged, driver =3D g_new0(virStorageDriverState, 1); =20 driver->lockFD =3D -1; - if (virMutexInit(&driver->lock) < 0) { - VIR_FREE(driver); - return VIR_DRV_STATE_INIT_ERROR; - } storageDriverLock(); =20 if (!(driver->pools =3D virStoragePoolObjListNew())) @@ -392,7 +390,6 @@ storageStateCleanup(void) VIR_FREE(driver->autostartDir); VIR_FREE(driver->stateDir); storageDriverUnlock(); - virMutexDestroy(&driver->lock); VIR_FREE(driver); =20 return 0; --=20 2.31.1