From nobody Wed May 14 22:08:41 2025 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1515528381470580.3536777938631; Tue, 9 Jan 2018 12:06:21 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id DA3A4780E5; Tue, 9 Jan 2018 20:06:13 +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 B437D8060C; Tue, 9 Jan 2018 20:06:11 +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 7013F410B4; Tue, 9 Jan 2018 20:06:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w09K63iB030554 for ; Tue, 9 Jan 2018 15:06:03 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6E09B7F7F7; Tue, 9 Jan 2018 20:06:03 +0000 (UTC) Received: from unknown4ceb42c824f4.attlocal.net.com (ovpn-116-205.phx2.redhat.com [10.3.116.205]) by smtp.corp.redhat.com (Postfix) with ESMTP id E727C60FB9 for ; Tue, 9 Jan 2018 20:06:01 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Tue, 9 Jan 2018 15:05:50 -0500 Message-Id: <20180109200553.22516-2-jferlan@redhat.com> In-Reply-To: <20180109200553.22516-1-jferlan@redhat.com> References: <20180109200553.22516-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/4] storage: When delete volume avoid disk backend removal 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 09 Jan 2018 20:06:14 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" For a disk backend, the deleteVol code will clear all the volumes in the pool and perform a pool refresh, thus the storageVolDeleteInternal should not use access @voldef after deleteVol succeeds. Signed-off-by: John Ferlan --- src/storage/storage_driver.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index f590f6b9b..3b66d5171 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -1670,15 +1670,21 @@ storageVolDeleteInternal(virStorageVolPtr vol, if (backend->deleteVol(vol->conn, obj, voldef, flags) < 0) goto cleanup; =20 + /* The disk backend updated the pool data including removing the + * voldef from the pool (for both the deleteVol and the createVol + * failure path. */ + if (def->type =3D=3D VIR_STORAGE_POOL_DISK) { + ret =3D 0; + goto cleanup; + } + /* Update pool metadata - don't update meta data from error paths * in this module since the allocation/available weren't adjusted yet. * Ignore the disk backend since it updates the pool values. */ if (updateMeta) { - if (def->type !=3D VIR_STORAGE_POOL_DISK) { - def->allocation -=3D voldef->target.allocation; - def->available +=3D voldef->target.allocation; - } + def->allocation -=3D voldef->target.allocation; + def->available +=3D voldef->target.allocation; } =20 virStoragePoolObjRemoveVol(obj, voldef); --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list