From nobody Wed Nov 27 04:53:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1558708620; cv=none; d=zoho.com; s=zohoarc; b=c/YHPlQBn5eXg6alcNOYtWRi+fKpqLUIhZ8QodYmdQAyaMN1VfeZTphm003aH33fWvP+X9RAAbNbhjV3ab9i+P9xWkihmq+GUMXD0w+YbSdGTzSmAfiRBCO2h0cteSjWk+9QxWqdVzrV+2ojqmYONTYQIHxl7hJRu8kr92P3B+E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558708620; h=Content-Type:Content-Transfer-Encoding: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:ARC-Authentication-Results; bh=+O4VdDLuh52EYzAY+6G2dyowRpT+iSOskn2hYAj94ec=; b=Pr6ORuLX+WklQBWu9WzyPtO6PWgftvNXDa94NTNeeuFmOf3N9gdITuQYXTHPvtxqYJ1zgVGTJ/Qrz1AkKIPM4lz3zHTbKYxbKBuPgJ9iRwl5obvDbc5qHQ3+nkAn21ImqZSjRMjUGob5x+13s4KHwXQo5X4S6QkFKe1D6/seolw= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1558708620871727.6978503413767; Fri, 24 May 2019 07:37:00 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id E6CC188E5E; Fri, 24 May 2019 14:36:28 +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 2926810027BC; Fri, 24 May 2019 14:36:17 +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 9535A5B423; Fri, 24 May 2019 14:36:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4OEZxST011296 for ; Fri, 24 May 2019 10:35:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0733369287; Fri, 24 May 2019 14:35:59 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 83AD517243 for ; Fri, 24 May 2019 14:35:58 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Fri, 24 May 2019 16:35:37 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v1 01/11] virStoragePoolObjRemove: Don't unlock pool object upon return 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 24 May 2019 14:36:54 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The fact that we're removing a pool object from the list of pools doesn't mean we want to unlock it. It violates locking policy too as object locking and unlocking is not done on the same level. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/conf/virstorageobj.c | 5 ++--- src/storage/storage_driver.c | 17 +++-------------- src/test/test_driver.c | 14 +++----------- 3 files changed, 8 insertions(+), 28 deletions(-) diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c index 31b5af8e9e..6af4a1a22d 100644 --- a/src/conf/virstorageobj.c +++ b/src/conf/virstorageobj.c @@ -514,7 +514,6 @@ virStoragePoolObjRemove(virStoragePoolObjListPtr pools, virObjectLock(obj); virHashRemoveEntry(pools->objs, uuidstr); virHashRemoveEntry(pools->objsName, obj->def->name); - virObjectUnlock(obj); virObjectUnref(obj); virObjectRWUnlock(pools); } @@ -1594,13 +1593,13 @@ virStoragePoolObjLoad(virStoragePoolObjListPtr pool= s, VIR_FREE(obj->configFile); /* for driver reload */ if (VIR_STRDUP(obj->configFile, path) < 0) { virStoragePoolObjRemove(pools, obj); - virObjectUnref(obj); + virStoragePoolObjEndAPI(&obj); return NULL; } VIR_FREE(obj->autostartLink); /* for driver reload */ if (VIR_STRDUP(obj->autostartLink, autostartLink) < 0) { virStoragePoolObjRemove(pools, obj); - virObjectUnref(obj); + virStoragePoolObjEndAPI(&obj); return NULL; } =20 diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 496d51b1e0..c14620765e 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -125,8 +125,7 @@ virStoragePoolUpdateInactive(virStoragePoolObjPtr *objp= tr) =20 if (!virStoragePoolObjGetConfigFile(obj)) { virStoragePoolObjRemove(driver->pools, obj); - virObjectUnref(obj); - *objptr =3D NULL; + virStoragePoolObjEndAPI(objptr); } else if (virStoragePoolObjGetNewDef(obj)) { virStoragePoolObjDefUseNewDef(obj); } @@ -760,12 +759,8 @@ storagePoolCreateXML(virConnectPtr conn, =20 if (build_flags || (flags & VIR_STORAGE_POOL_CREATE_WITH_BUILD)) { - if (backend->buildPool(obj, build_flags) < 0) { - virStoragePoolObjRemove(driver->pools, obj); - virObjectUnref(obj); - obj =3D NULL; - goto cleanup; - } + if (backend->buildPool(obj, build_flags) < 0) + goto error; } } =20 @@ -798,8 +793,6 @@ storagePoolCreateXML(virConnectPtr conn, =20 error: virStoragePoolObjRemove(driver->pools, obj); - virObjectUnref(obj); - obj =3D NULL; goto cleanup; } =20 @@ -835,8 +828,6 @@ storagePoolDefineXML(virConnectPtr conn, =20 if (virStoragePoolObjSaveDef(driver, obj, newDef ? newDef : def) < 0) { virStoragePoolObjRemove(driver->pools, obj); - virObjectUnref(obj); - obj =3D NULL; newDef =3D NULL; goto cleanup; } @@ -903,8 +894,6 @@ storagePoolUndefine(virStoragePoolPtr pool) =20 VIR_INFO("Undefining storage pool '%s'", def->name); virStoragePoolObjRemove(driver->pools, obj); - virObjectUnref(obj); - obj =3D NULL; ret =3D 0; =20 cleanup: diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 7fd06fcfa8..a0f19f5c5c 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -4595,16 +4595,12 @@ testStoragePoolCreateXML(virConnectPtr conn, def->source.adapter.data.fchost.wwnn, def->source.adapter.data.fchost.wwpn) < 0) { virStoragePoolObjRemove(privconn->pools, obj); - virObjectUnref(obj); - obj =3D NULL; goto cleanup; } } =20 if (testStoragePoolObjSetDefaults(obj) =3D=3D -1) { virStoragePoolObjRemove(privconn->pools, obj); - virObjectUnref(obj); - obj =3D NULL; goto cleanup; } =20 @@ -4662,8 +4658,6 @@ testStoragePoolDefineXML(virConnectPtr conn, =20 if (testStoragePoolObjSetDefaults(obj) =3D=3D -1) { virStoragePoolObjRemove(privconn->pools, obj); - virObjectUnref(obj); - obj =3D NULL; goto cleanup; } =20 @@ -4692,7 +4686,7 @@ testStoragePoolUndefine(virStoragePoolPtr pool) 0); =20 virStoragePoolObjRemove(privconn->pools, obj); - virObjectUnref(obj); + virStoragePoolObjEndAPI(&obj); =20 virObjectEventStateQueue(privconn->eventState, event); return 0; @@ -4784,11 +4778,9 @@ testStoragePoolDestroy(virStoragePoolPtr pool) VIR_STORAGE_POOL_EVENT_STOPPED, 0); =20 - if (!(virStoragePoolObjGetConfigFile(obj))) { + if (!(virStoragePoolObjGetConfigFile(obj))) virStoragePoolObjRemove(privconn->pools, obj); - virObjectUnref(obj); - obj =3D NULL; - } + ret =3D 0; =20 cleanup: --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list