From nobody Mon Feb 9 18:17:43 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=1649775489; cv=none; d=zohomail.com; s=zohoarc; b=eRMFsHzJqLGyMIIaq9toDUAnGvysKe14buVfpDbFrw7PKkcvQT17AaYX/njouWKTv3gmPGV9u6cQC/xeJvmxuuQFKse/IL9fkI38wcssRQOC7xn8r+fwAHLJHAev6vaRZonyo42qVqFD5EBSjEhR1oMUWAKc1WFNfbVNFlOckoI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1649775489; 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=3U9UFcWQW37sZYwh6LAK8uE16aQ+5qZ4bUikWOr3/94=; b=n7zMwqRWuPAWkXD8TK4BPU/wZPKhi3P1iU8BVyNuI2pHrR431Lh8nt+B2U8Biw3exD4BugBNMdPTRo2wy5WelIyPADJF06dOyK84vTnnGA24VtszRulGbGTq/gMddUuUdL/LuzTdyze6iflpZ4YJnzgyd8VqaoRMaj3Fp3Fe30U= 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 1649775489872326.86607289651784; Tue, 12 Apr 2022 07:58:09 -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-158-l_GEM-qDNXyf1nBgSXLSkw-1; Tue, 12 Apr 2022 10:58:07 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1418D100F81E; Tue, 12 Apr 2022 14:57:34 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id DBA89145BEEC; Tue, 12 Apr 2022 14:57:33 +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 4523F193F507; Tue, 12 Apr 2022 14:57:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 54E161940365 for ; Tue, 12 Apr 2022 14:57:32 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 47911432045; Tue, 12 Apr 2022 14:57:32 +0000 (UTC) Received: from work.redhat.com (unknown [10.39.194.239]) by smtp.corp.redhat.com (Postfix) with ESMTP id C5D264292CD; Tue, 12 Apr 2022 14:57:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649775488; 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=3U9UFcWQW37sZYwh6LAK8uE16aQ+5qZ4bUikWOr3/94=; b=bAnNXGiRsjZe2fOFz3P5QieKC8f6uiQC9ChTKpwwAmMzuyrqGeNGk5MDD8Nsf819BISw+6 zatthxIERwm4nGi5cbHoKpj6sWd+GCfjugkYwDRnuKRmPPVEo3IBeV+vi3QpTLvHLcuV4n 0TLBEAGE+KM+odV5P0BknqXxWmOsYB4= X-MC-Unique: l_GEM-qDNXyf1nBgSXLSkw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 04/10] virStorageVolObjNew: Move locking to usage site Date: Tue, 12 Apr 2022 16:57:21 +0200 Message-Id: <20220412145727.69564-5-twiederh@redhat.com> In-Reply-To: <20220412145727.69564-1-twiederh@redhat.com> References: <20220412145727.69564-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 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: , Cc: Tim Wiederhake Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 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: 1649776394062100001 Content-Type: text/plain; charset="utf-8"; x-default="true" This allows a later patch to replace virObjectLock/Unlock pairs with automatic mutex management code. Signed-off-by: Tim Wiederhake --- src/conf/virstorageobj.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c index 108ae0aeb1..c837f96ae6 100644 --- a/src/conf/virstorageobj.c +++ b/src/conf/virstorageobj.c @@ -125,16 +125,10 @@ VIR_ONCE_GLOBAL_INIT(virStorageVolObj); static virStorageVolObj * virStorageVolObjNew(void) { - virStorageVolObj *obj; - if (virStorageVolObjInitialize() < 0) return NULL; =20 - if (!(obj =3D virObjectLockableNew(virStorageVolObjClass))) - return NULL; - - virObjectLock(obj); - return obj; + return virObjectLockableNew(virStorageVolObjClass); } =20 =20 @@ -638,6 +632,8 @@ virStoragePoolObjAddVol(virStoragePoolObj *obj, return -1; } =20 + virObjectLock(volobj); + g_hash_table_insert(volumes->objsKey, g_strdup(voldef->key), volobj); virObjectRef(volobj); =20 --=20 2.31.1