From nobody Mon Feb 9 10:47:51 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1586526982; cv=none; d=zohomail.com; s=zohoarc; b=GNYxAOTfXCRdXJ+6Eml2BzfoFi0iUOKZJrAN1EtCQyAX0484PPk39T/tk+iATcGLWYElMjRaO7D8S0vTB8h+pyLe+hAJ2nhyv3A1YwUC438UjARb+wKyqhPzOo7SkQPt3uKYn5ickA7jmY3h7pkIIETjifd4torQRoZAkJaP5/c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586526982; 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=DVPEUh6tjMppZUfI0B2Oi2+AinSzNU8Gq0mcOCwbgfg=; b=lZW6DsZj4FHdedeUs/wKcxKU4B+BW/OUHZMocEweD8C2d8TFzsFfQu8v7/4MH9ZskXIvol1wcb9vVw/1LXh/PZ8iA9AzN90Wk5iSOO2T86G2e4rI7Z8MERZIMliwSYIkimgjyIGchded/kCvS1v2WJ9F4fZ37NOgDDAAk0ms+1o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1586526982554353.86170012998116; Fri, 10 Apr 2020 06:56:22 -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-241-wxnCj8r2OwS8GLdcAbnWHQ-1; Fri, 10 Apr 2020 09:56:19 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C471E107ACC9; Fri, 10 Apr 2020 13:56:13 +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 9A65A5DA75; Fri, 10 Apr 2020 13:56:13 +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 5553B1803C33; Fri, 10 Apr 2020 13:56:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADtjTK022992 for ; Fri, 10 Apr 2020 09:55:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7CE1F10EE826; Fri, 10 Apr 2020 13:55:45 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 78AF310EE823 for ; Fri, 10 Apr 2020 13:55:45 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5704F185A78E for ; Fri, 10 Apr 2020 13:55:45 +0000 (UTC) Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-497-3hj1NVHAMPO4r_bWZ8zyug-1; Fri, 10 Apr 2020 09:55:42 -0400 Received: by mail-wr1-f65.google.com with SMTP id f13so2344303wrm.13 for ; Fri, 10 Apr 2020 06:55:42 -0700 (PDT) Received: from localhost.localdomain (public-gprs377075.centertel.pl. [37.47.104.52]) by smtp.gmail.com with ESMTPSA id c11sm3066319wrt.24.2020.04.10.06.55.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:55:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586526981; 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=DVPEUh6tjMppZUfI0B2Oi2+AinSzNU8Gq0mcOCwbgfg=; b=HiPFZq14wu9OWsfu0hoM0ZQxZDXJnmnID2MLk5lsZQYFmeoCGUc8x0FSLNYg8V9U8QXd+4 KQeyBR2UuF+L18hJXrRximIJAFHxbbg0Cjg6M718WG9sX3kKZ+37KCFUjxS+pBZZAl7W2X AMQeoybwE81zuLjXvNkf5Wyfs2YXrrI= X-MC-Unique: wxnCj8r2OwS8GLdcAbnWHQ-1 X-MC-Unique: 3hj1NVHAMPO4r_bWZ8zyug-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3Oq6sZFjQNurBnRarOiKO3C+QgBfXyfLYBYDygiBBOs=; b=XxDPsD8G9H6HePX51MnV5HHUDodPzaFaxp7Zip4dZwzOxU0qqoh/J26nrVzjQXyEL8 xnnfRBI8lEyiz4x4dZiKFNBv/ZfaGuaQe41/ODBvstiN3wozPRkibkPyaaowtBWRGtXJ EhC2+/6qDkFJUYx9FwxLoihgts/HJyj0hSEx3dcYCNyuEZCV3OnZ2wWGTWngaN0clMCO 0dTiBXdjanHOtZRK7xQuNoo4Y62jMkgnD6N4dt5MFFbv+PdKT9VJVp7MO7Y8ulK6gkwe z41pl1PdEWb84NVLXt62IMDvCXcSCEM+zce9ydT51XbLZLAFGpBIR5Fk0vFOH4RsTqOh iC+A== X-Gm-Message-State: AGi0Pub6EIhi1d9KysWcYydbiPZCross1Xh9VfKDqWaPs3sRakKivP3S H4WIeppdF8oLZvBeVT5MAmwEzlTsm8s= X-Google-Smtp-Source: APiQypLnEze5a5q/dY4BZDmHZ/Vxmz2cJjn2PSLfkfCNK3g2Xt+UfbPgyXKlN5IOMahr30lHlsPyuA== X-Received: by 2002:a5d:6204:: with SMTP id y4mr5034966wru.410.1586526941500; Fri, 10 Apr 2020 06:55:41 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 10/43] vz: vz_driver: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:54:37 +0200 Message-Id: <20200410135510.2148319-11-r4f4rfs@gmail.com> In-Reply-To: <20200410135510.2148319-1-r4f4rfs@gmail.com> References: <20200410135510.2148319-1-r4f4rfs@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADtjTK022992 X-loop: libvir-list@redhat.com Cc: Rafael Fonseca 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.14 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" Signed-off-by: Rafael Fonseca --- src/vz/vz_driver.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c index d882b91def..058e5b8614 100644 --- a/src/vz/vz_driver.c +++ b/src/vz/vz_driver.c @@ -67,7 +67,7 @@ static virClassPtr vzDriverClass; static bool vz_driver_privileged; /* pid file FD, ensures two copies of the driver can't use the same root */ static int vz_driver_lock_fd =3D -1; -static virMutex vz_driver_lock; +G_LOCK_DEFINE_STATIC(vz_driver_lock); static vzDriverPtr vz_driver; static vzConnPtr vz_conn_list; =20 @@ -177,11 +177,11 @@ vzGetDriverConnection(void) "%s", _("vz state driver is not active")); return NULL; } - virMutexLock(&vz_driver_lock); + G_LOCK(vz_driver_lock); if (!vz_driver) vz_driver =3D vzDriverObjNew(); virObjectRef(vz_driver); - virMutexUnlock(&vz_driver_lock); + G_UNLOCK(vz_driver_lock); =20 return vz_driver; } @@ -192,10 +192,10 @@ vzDestroyDriverConnection(void) vzDriverPtr driver; vzConnPtr privconn_list; =20 - virMutexLock(&vz_driver_lock); + G_LOCK(vz_driver_lock); driver =3D g_steal_pointer(&vz_driver); privconn_list =3D g_steal_pointer(&vz_conn_list); - virMutexUnlock(&vz_driver_lock); + G_UNLOCK(vz_driver_lock); =20 while (privconn_list) { vzConnPtr privconn =3D privconn_list; @@ -389,10 +389,10 @@ vzConnectOpen(virConnectPtr conn, if (!(privconn->closeCallback =3D virNewConnectCloseCallbackData())) goto error; =20 - virMutexLock(&vz_driver_lock); + G_LOCK(vz_driver_lock); privconn->next =3D vz_conn_list; vz_conn_list =3D privconn; - virMutexUnlock(&vz_driver_lock); + G_UNLOCK(vz_driver_lock); =20 return VIR_DRV_OPEN_SUCCESS; =20 @@ -413,7 +413,7 @@ vzConnectClose(virConnectPtr conn) if (!privconn) return 0; =20 - virMutexLock(&vz_driver_lock); + G_LOCK(vz_driver_lock); for (curr =3D vz_conn_list; curr; prev =3D &curr->next, curr =3D curr-= >next) { if (curr =3D=3D privconn) { *prev =3D curr->next; @@ -421,7 +421,7 @@ vzConnectClose(virConnectPtr conn) } } =20 - virMutexUnlock(&vz_driver_lock); + G_UNLOCK(vz_driver_lock); =20 virObjectUnref(privconn->closeCallback); virObjectUnref(privconn->driver); @@ -4094,7 +4094,6 @@ vzStateCleanup(void) vz_driver =3D NULL; if (vz_driver_lock_fd !=3D -1) virPidFileRelease(VZ_STATEDIR, "driver", vz_driver_lock_fd); - virMutexDestroy(&vz_driver_lock); prlsdkDeinit(); } return 0; @@ -4132,17 +4131,10 @@ vzStateInitialize(bool privileged, return VIR_DRV_STATE_INIT_ERROR; } =20 - if (virMutexInit(&vz_driver_lock) < 0) - goto error; - /* Failing to create driver here is not fatal and only means * that next driver client will try once more when connecting */ vz_driver =3D vzDriverObjNew(); return VIR_DRV_STATE_INIT_COMPLETE; - - error: - vzStateCleanup(); - return VIR_DRV_STATE_INIT_ERROR; } =20 static virStateDriver vzStateDriver =3D { --=20 2.25.2