From nobody Fri May 15 10:54:28 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=none dis=none) header.from=gmelikov.ru ARC-Seal: i=1; a=rsa-sha256; t=1777387778; cv=none; d=zohomail.com; s=zohoarc; b=MRH3IyLoelmmtKdkbTIz1NlmID1vquiM+gMqHhvWAyC3IfWzj0lDMWh6HXrBF+Hc34eV2wGPxOBPod9WR9JUBj/KmOLY/hPA3oaWkipWk9hEUXMTpOjg15L7TJbla9mR4aR1iyDhiKjvMqVGYYvt0KsVU7xMYiH/TT/SD2ZaGoY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777387778; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=iVgzOz1R8ygz12YM26sKODguZxJOYHY7hW8hMRl2O4E=; b=cjzQ3Tnm4Ib+7YTWmylZ4SCMhyv6B7laYIlTb60sVLHkDGa0gmv3ioVLVavcOpc12ZkctoW5hhRshqECn6ihHQRLx1q1qUOQhj8biBX57vm0bK0txMteUz5adNfE2oeIxl6kFF5koljJDaAwryp9Nv9a0iEoy981j+fF1byCCMI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1777387777845848.6782229743645; Tue, 28 Apr 2026 07:49:37 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 8E7CC3F252; Tue, 28 Apr 2026 10:49:36 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 312924193F; Tue, 28 Apr 2026 10:48:44 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 4AED13F280; Tue, 28 Apr 2026 10:48:36 -0400 (EDT) Received: from forward202d.mail.yandex.net (forward202d.mail.yandex.net [178.154.239.219]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 7CADE3F252 for ; Tue, 28 Apr 2026 10:48:33 -0400 (EDT) Received: from forward102d.mail.yandex.net (forward102d.mail.yandex.net [IPv6:2a02:6b8:c41:1300:1:45:d181:d102]) by forward202d.mail.yandex.net (Yandex) with ESMTPS id 4F04186E8A for ; Tue, 28 Apr 2026 17:42:48 +0300 (MSK) Received: from mail-nwsmtp-smtp-production-main-52.klg.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-52.klg.yp-c.yandex.net [IPv6:2a02:6b8:c42:ea2:0:640:ef77:0]) by forward102d.mail.yandex.net (Yandex) with ESMTPS id DEFCDC00BC for ; Tue, 28 Apr 2026 17:42:41 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-52.klg.yp-c.yandex.net (smtp) with ESMTPSA id egaMdI3R3mI0-viCANElN; Tue, 28 Apr 2026 17:42:41 +0300 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=4.0.1 X-Greylist: delayed 348 seconds by postgrey-1.37 at lists.libvirt.org; Tue, 28 Apr 2026 10:48:33 EDT X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmelikov.ru; s=mail; t=1777387361; bh=iVgzOz1R8ygz12YM26sKODguZxJOYHY7hW8hMRl2O4E=; h=Message-ID:Date:Cc:Subject:To:From; b=OT1/JL0WiXQ3TG1ouXq0rVokEso24UCFc/0up6vhnJH4I1sIcRmDRGXtPJ9u/qTzz AB88tK0Jz3aFG2YIH8ynIVaTWc6EWgd9/Mm98tPmSgusXm2Y7RYZSDPvoVdJluPl4A OgrW7uLTNqiKL5PInsnpKKFKYcp5zU4p09nuw9iw= Authentication-Results: mail-nwsmtp-smtp-production-main-52.klg.yp-c.yandex.net; dkim=pass header.i=@gmelikov.ru From: George Melikov To: devel@lists.libvirt.org Subject: [PATCH] ZFS: fix incorrect volsize,refreservation on zvol creation Date: Tue, 28 Apr 2026 17:40:56 +0300 Message-ID: <20260428144236.1104986-1-mail@gmelikov.ru> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: O6QCCDCZGDRSILILQR3D4L5JDKTICFC4 X-Message-ID-Hash: O6QCCDCZGDRSILILQR3D4L5JDKTICFC4 X-MailFrom: mail@gmelikov.ru X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: George Melikov X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: pass (identity @gmelikov.ru) X-ZM-MESSAGEID: 1777387779366158500 Content-Type: text/plain; charset="utf-8" From: George Melikov Reproduce: ```bash # Order is crucial here, if we create zvol with name which won't be last - = we'll get size from different zvol root@minime:~# virsh vol-list rpool Name Path Reviewed-by: Roman Bogorodskiy ---------------------------------------------------------------------------= ------------------------- da52bdd9-eb75-5746-a2ce-a511067914f5 /dev/zvol/rpool/disks/da52bdd9-eb75= -5746-a2ce-a511067914f5 faafd0f9-33c8-5b23-990c-fa7b4bfe8dcf /dev/zvol/rpool/disks/faafd0f9-33c8= -5b23-990c-fa7b4bfe8dcf # Create zvol with name which will be before `faaf...` root@minime:~# cat > /tmp/vol eeee 4294967296 4294967296 root@minime:~# virsh vol-create rpool /tmp/vol Vol eeee created from /tmp/vol root@minime:~# virsh vol-list rpool Name Path ---------------------------------------------------------------------------= ------------------------- da52bdd9-eb75-5746-a2ce-a511067914f5 /dev/zvol/rpool/disks/da52bdd9-eb75= -5746-a2ce-a511067914f5 eeee /dev/zvol/rpool/disks/eeee faafd0f9-33c8-5b23-990c-fa7b4bfe8dcf /dev/zvol/rpool/disks/faafd0f9-33c8= -5b23-990c-fa7b4bfe8dcf # Here we've got Capacity from last zvol (ordered by name) root@minime:~# virsh vol-info --pool rpool eeee Name: eeee Type: block Capacity: 10.00 GiB Allocation: 0.00 B # Full refresh fixes it root@minime:~# virsh pool-refresh --pool rpool Pool rpool refreshed root@minime:~# virsh vol-info --pool rpool eeee Name: eeee Type: block Capacity: 4.00 GiB Allocation: 4.06 GiB ``` Fix is trivial: check zvol by name and return early if this is different zvol. Signed-off-by: George Melikov --- src/storage/storage_backend_zfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/storage/storage_backend_zfs.c b/src/storage/storage_backen= d_zfs.c index 33434d0cac..2cb555a6e6 100644 --- a/src/storage/storage_backend_zfs.c +++ b/src/storage/storage_backend_zfs.c @@ -132,8 +132,10 @@ virStorageBackendZFSParseVol(virStoragePoolObj *pool, =20 if (vol =3D=3D NULL) volume =3D virStorageVolDefFindByName(pool, vol_name); - else + else if (STREQ(vol_name, vol->name)) volume =3D vol; + else + return 0; =20 if (volume =3D=3D NULL) { volume =3D g_new0(virStorageVolDef, 1); --=20 2.53.0