From nobody Mon Feb 9 08:55:37 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=1586526988; cv=none; d=zohomail.com; s=zohoarc; b=kZoj9lMDcd9l2GSL/asQrBhpYaYhGqLrpYvK5tyWJ+WlLLILXa0H2vSIwlPCFgHznqQ5HKsbHyXy42GwJV/01VKkAF2oFm3aJB5pz/epUXm0GjONGJ8G6a25LSMUPDTqXAHx698+zMvZ1Lm+QjtoQ4Ywqu3HzYrnp+J02iseCrc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586526988; 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=y+Bq7VRGO2zQUg9ZcznZ/btDgUeuMiBc0ih1N1PgnCI=; b=DTXQOHonwOrVYTECni/SDtkDU/b6sSosw07v4EhLIAiktK/Uovlxeqgivfgc484/ugBQkOCkghCnE9JSFK1E2YOIeemfks9zfwKjogJUsiFOK9ukGdCQSGXBHW2HIFJdRc7JgWwW4BGXgNmVmY9jcYWFHRRWsZGrWPApavRMzxQ= 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-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1586526988543555.6230902894499; Fri, 10 Apr 2020 06:56:28 -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-159-XPS74TwoNd-17Re_lEWTHA-1; Fri, 10 Apr 2020 09:56:22 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1BB22DB2C; Fri, 10 Apr 2020 13:56:17 +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 E39C0272A5; Fri, 10 Apr 2020 13:56:16 +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 94CE893097; Fri, 10 Apr 2020 13:56:16 +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 03ADtv4L023087 for ; Fri, 10 Apr 2020 09:55:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 856E910EE828; Fri, 10 Apr 2020 13:55:57 +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 8160610EE826 for ; Fri, 10 Apr 2020 13:55:55 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (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 9B90F185A78F for ; Fri, 10 Apr 2020 13:55:55 +0000 (UTC) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-234-QzPo8GT8PJOJe7PZJ_qMnQ-1; Fri, 10 Apr 2020 09:55:53 -0400 Received: by mail-wm1-f65.google.com with SMTP id x4so2580061wmj.1 for ; Fri, 10 Apr 2020 06:55:52 -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.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:55:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586526986; 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=y+Bq7VRGO2zQUg9ZcznZ/btDgUeuMiBc0ih1N1PgnCI=; b=MriUya+4hZlWtkemqHn4nikMbw7LlGvHqKvqntHBAzd9E9fjIN/BZjZ0TKaDB6/SKPM05/ e+vpCLMQbxXhXbvLgv5JOWPnn+K22Usk3MRe7ilmBqzJ5S9++JT2mtR3SDJRAo/l20pjcN bzKt76bEtRVP5aqf/3lS+X86RtJfNiU= X-MC-Unique: XPS74TwoNd-17Re_lEWTHA-1 X-MC-Unique: QzPo8GT8PJOJe7PZJ_qMnQ-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=invnmFSvmDkqzTN60j/EZ3EoAsC5AYlGJbGS99ysjYs=; b=lMTnDQi9Zg7z14tP2SkN1jdpoIufubZ2Ns+8/Y+SNo0pH/U1hEnJ8rmvZDpBDtNIoD 3UTl8z1jkimBws2yBWUYZzi7XJ4gcgd0nOewfhqMo5MUA9T7iHNmkVUuB7iTKy/JkX55 H2cBv3nWBo9kvmSkhJg6LZDGeX7X6tHPgY323WMOStTYl8t1srRIN7503vLYmyuO4Dob +AB5MV1VYIaqnUUqYBFa+7czLVnXMiykBgC4KP+5eTWMlR38LHVkpGVaA47/+VddL6yo TuVstdLysT7jdsJFhMHUG9Ra5YC7ykhDIy81TQ+XK/QSXFyW7i0b6zQRs75rBoP80O1k UoXA== X-Gm-Message-State: AGi0PuaZEE45Yu0Rb8wjBQ4MOsECqJ47DmJx3M1lUICudfO5k7aTt6if qWF50hRE9WO4xAp+PsgZI2cUgZ33910= X-Google-Smtp-Source: APiQypIOqYKkL3x7O/N2ziriN9v1TFWv+zBuR1CMa2k52+gmd4WDZvxV7Xq1MFtuKbBDeVeHPuGmeg== X-Received: by 2002:a7b:c642:: with SMTP id q2mr5451960wmk.41.1586526951572; Fri, 10 Apr 2020 06:55:51 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 18/43] lxc: lxc_fuse: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:54:45 +0200 Message-Id: <20200410135510.2148319-19-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 03ADtv4L023087 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.84 on 10.5.11.23 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/lxc/lxc_fuse.c | 13 +++++-------- src/lxc/lxc_fuse.h | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c index e73b4d0690..e35086c859 100644 --- a/src/lxc/lxc_fuse.c +++ b/src/lxc/lxc_fuse.c @@ -262,11 +262,10 @@ static struct fuse_operations lxcProcOper =3D { =20 static void lxcFuseDestroy(virLXCFusePtr fuse) { - virMutexLock(&fuse->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&fuse->lock); fuse_unmount(fuse->mountpoint, fuse->ch); fuse_destroy(fuse->fuse); fuse->fuse =3D NULL; - virMutexUnlock(&fuse->lock); } =20 static void lxcFuseRun(void *opaque) @@ -291,8 +290,7 @@ int lxcSetupFuse(virLXCFusePtr *f, virDomainDefPtr def) =20 fuse->def =3D def; =20 - if (virMutexInit(&fuse->lock) < 0) - goto cleanup2; + g_mutex_init(&fuse->lock); =20 fuse->mountpoint =3D g_strdup_printf("%s/%s.fuse/", LXC_STATE_DIR, def= ->name); =20 @@ -327,8 +325,7 @@ int lxcSetupFuse(virLXCFusePtr *f, virDomainDefPtr def) return ret; cleanup1: VIR_FREE(fuse->mountpoint); - virMutexDestroy(&fuse->lock); - cleanup2: + g_mutex_clear(&fuse->lock); VIR_FREE(fuse); goto cleanup; } @@ -351,10 +348,10 @@ void lxcFreeFuse(virLXCFusePtr *f) if (fuse) { /* exit fuse_loop, lxcFuseRun thread may try to destroy * fuse->fuse at the same time,so add a lock here. */ - virMutexLock(&fuse->lock); + g_mutex_lock(&fuse->lock); if (fuse->fuse) fuse_exit(fuse->fuse); - virMutexUnlock(&fuse->lock); + g_mutex_unlock(&fuse->lock); =20 VIR_FREE(fuse->mountpoint); VIR_FREE(*f); diff --git a/src/lxc/lxc_fuse.h b/src/lxc/lxc_fuse.h index e9cfd9a20a..47ca7197fc 100644 --- a/src/lxc/lxc_fuse.h +++ b/src/lxc/lxc_fuse.h @@ -48,7 +48,7 @@ struct virLXCFuse { char *mountpoint; struct fuse *fuse; struct fuse_chan *ch; - virMutex lock; + GMutex lock; }; typedef struct virLXCFuse *virLXCFusePtr; =20 --=20 2.25.2