From nobody Mon Feb 9 17:22:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1645103043; cv=none; d=zohomail.com; s=zohoarc; b=S+mYtyjtOS6CJi+2Gydur1c1Bm6kW+zpiI9F0XsGMVm3zfkrqoElllNmZ3XyPVzwHokLgUtlStagu06Qd83lMFt64EupAucuZx3Hep6RAMDktjqkcuOP+8l/S72tZ4X9YgsMfpng9Aldm0eZ8BeYovpni880BkhPSESxzy4zIpA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1645103043; 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=jp76mhVesSPv2/L55N7/nBPxHtiGlKAWqOsOVEQhZG4=; b=TgJafz8eFDXOOMilpDaXspXHfWoN5mNVr+bk98EiVPTlqvfAL6IfTarjfdLVAzn57O9ZGThTwOrISim/dmGRVPCsZGpFTo+r7+v6qIhc5GD7c23hwL6Z+OrkishU8f31BRS6h/cywrW0K2UiiglCpARv0W3vuKyFjQyBVnYWrCg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1645103043507376.82978993667325; Thu, 17 Feb 2022 05:04:03 -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-299-VMDEMAnFNOmAjmcBB8rVNA-1; Thu, 17 Feb 2022 08:03:57 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 85338801ADB; Thu, 17 Feb 2022 13:03:52 +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 64ABF6E216; Thu, 17 Feb 2022 13:03:52 +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 364B346FA4; Thu, 17 Feb 2022 13:03:52 +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 21HD1GO4031263 for ; Thu, 17 Feb 2022 08:01:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id 604BC2B3A7; Thu, 17 Feb 2022 13:01:16 +0000 (UTC) Received: from work.speedport.ip (unknown [10.39.194.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id A37242B4B4; Thu, 17 Feb 2022 13:01:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645103041; 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=jp76mhVesSPv2/L55N7/nBPxHtiGlKAWqOsOVEQhZG4=; b=dVjJ/WaOlGnYK0aYJtuE0D6Cv49ohFH9Y61W2SvXn/sI1zXi/UQeHPMHxIurrb4ayPHPNG /oTZjNaN0rWF8MPo3UP3TdLrJf5ICqCTSyJ6mYj5MV9VsalTFnzfZVTdmSri+qOdbOMZNv hFtraXIeLIdRq+qTM/SLxurQDjz6HdI= X-MC-Unique: VMDEMAnFNOmAjmcBB8rVNA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 10/11] storage: Move and split up storateStateCleanup Date: Thu, 17 Feb 2022 14:01:02 +0100 Message-Id: <20220217130103.18543-11-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.79 on 10.5.11.11 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: 1645103052029100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake --- src/storage/storage_driver.c | 71 +++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 34 deletions(-) diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 05675a5539..3bd5d07efb 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -59,8 +59,6 @@ static virStorageDriverState *driver; =20 static virMutex mutex =3D VIR_MUTEX_INITIALIZER; =20 -static int storageStateCleanup(void); - typedef struct _virStorageVolStreamInfo virStorageVolStreamInfo; struct _virStorageVolStreamInfo { char *pool_name; @@ -248,6 +246,43 @@ storageDriverAutostart(void) NULL); } =20 +static int +storageStateCleanupLocked(void) +{ + if (!driver) + return -1; + + virObjectUnref(driver->caps); + virObjectUnref(driver->storageEventState); + + /* free inactive pools */ + virObjectUnref(driver->pools); + + if (driver->lockFD !=3D -1) + virPidFileRelease(driver->stateDir, "driver", + driver->lockFD); + + VIR_FREE(driver->configDir); + VIR_FREE(driver->autostartDir); + VIR_FREE(driver->stateDir); + VIR_FREE(driver); + + return 0; +} + +/** + * storageStateCleanup + * + * Shutdown the storage driver, it will stop all active storage pools + */ +static int +storageStateCleanup(void) +{ + VIR_LOCK_GUARD lock =3D virLockGuardLock(&mutex); + + return storageStateCleanupLocked(); +} + /** * virStorageStartup: * @@ -363,38 +398,6 @@ storageStateReload(void) } =20 =20 -/** - * storageStateCleanup - * - * Shutdown the storage driver, it will stop all active storage pools - */ -static int -storageStateCleanup(void) -{ - if (!driver) - return -1; - - storageDriverLock(); - - virObjectUnref(driver->caps); - virObjectUnref(driver->storageEventState); - - /* free inactive pools */ - virObjectUnref(driver->pools); - - if (driver->lockFD !=3D -1) - virPidFileRelease(driver->stateDir, "driver", - driver->lockFD); - - VIR_FREE(driver->configDir); - VIR_FREE(driver->autostartDir); - VIR_FREE(driver->stateDir); - storageDriverUnlock(); - VIR_FREE(driver); - - return 0; -} - static virDrvOpenStatus storageConnectOpen(virConnectPtr conn, virConnectAuthPtr auth G_GNUC_UNUSED, --=20 2.31.1