From nobody Tue Mar 3 03:04:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; 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 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1771811132; cv=none; d=zohomail.com; s=zohoarc; b=ghTb1VudtTzVKmc6H/nNxk40ghCCMDxBQofaoiDTrZoWUXd5Bbsz3w+hFXuhbGlb7A5IpReEsFZaAMOCXG0w84RBHo6EA2bkSXLqCNsF+C5Zz43N8D7qJVJCY/29BicT3kGj0sLnDHB/kDJtksFvlxyfu6x1l5uTED6nMTcfD1A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771811132; 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=/clGYI137zp4v3DVQuYTDQyEpzEqAaRZBksMUGI/e70=; b=emQOTM3nzWdkgOyOsDqHsnIbkie+4H30ByHdLF12gzZ4jG/r0/XjRp70SzFWVdI0QmBjmciR3mlYg3WBOX2AQtKcWnRW7UVERbfO54Nv44rYz9ZiR+f9kYJfaSUUFLpRmEHepgUovZP9bMj/1c/60NzyBTzrrfLl0teumvNADD0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 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 [8.43.85.245]) by mx.zohomail.com with SMTPS id 1771811132377379.9817623355374; Sun, 22 Feb 2026 17:45:32 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 0432D4198F; Sun, 22 Feb 2026 20:45:31 -0500 (EST) Received: from [172.19.199.9] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 869AE419AD; Sun, 22 Feb 2026 20:44:54 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id A0F094187D; Sun, 22 Feb 2026 20:44:49 -0500 (EST) Received: from mail-dl1-f52.google.com (mail-dl1-f52.google.com [74.125.82.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 35AE83FABD for ; Sun, 22 Feb 2026 20:44:49 -0500 (EST) Received: by mail-dl1-f52.google.com with SMTP id a92af1059eb24-126ea4e9694so4589332c88.1 for ; Sun, 22 Feb 2026 17:44:49 -0800 (PST) Received: from localhost.localdomain ([2804:29b8:5090:5879:e968:d1bb:87d4:1175]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1276af8a657sm6978509c88.12.2026.02.22.17.44.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 22 Feb 2026 17:44:46 -0800 (PST) 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,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HELO_MISC_IP,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771811088; x=1772415888; darn=lists.libvirt.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=/clGYI137zp4v3DVQuYTDQyEpzEqAaRZBksMUGI/e70=; b=Xd8CFm6FfPrLQv78MpkJLjVvTCBmAf7QRD7MF1vMT+ePZBD3CPaE8hcrCsHLAiDvoW cCRHo3N7+ibPsk8fxqwhMlcbLR/hePYauBvamNrUSAYhEPZ09IqMPp+Vj51OR82pRr8P eptHwM9wAnSH3GbTvbXYBjxKI9Ul+Ef5fVPjDH4ouj12aoqS7ti2ZfTxCMeYSF95DJFQ 4Yt3FQYsDyIaYhFkRIKLaC4UhGIHlspWKq55KBTTT3wvKFv2nVyaBqEm7kGk4vApiZC1 +E55mmTRj7scMZzFzzeMxiUzz04AbETAc9Cs6G218FIwVjKeJXS+1+wWhhu9TDv8kX5+ Amlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771811088; x=1772415888; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=/clGYI137zp4v3DVQuYTDQyEpzEqAaRZBksMUGI/e70=; b=m9HzrEfd8arslWcuGW9owrEYFmityEJnhGrR2NWeeF+THOX6MZHLQ6ZIDJSBbVK1zl DNsoG7PDgXmZ9uDF4+3YOF70oouCMDr2WlKwu5YJgFEYl+/AsoGVjBi49LvL2tFvaLip /m+RU3oi7gaqihA9TdlM7YMUIJzLkwODj5kLU071jFhyUdt/+HWMDxqPEDHyJHT4xKZC blO9vLeOQW9m6I6XrmyolppuN1RRBKWT2+SBSUoH1OzqRQwWjwBTLA+O5bT4HQ7FfgmQ boecnNJieRD+n8bdqiZOwFof5hunQHAnFtuWt2CFiR3rG0NLU5/17d//rpZC+8Tc7jjs qKoA== X-Gm-Message-State: AOJu0YyFA16Md6zYVWu3u1fsUqTgfWGxOnslB5eXIp958EHPF25yrVs7 WtmSDq+nwM9/oAjen92OBuvwcXTF7rQNC8n4OvI9YqCF8JdLSoe1ssWNJ4gJAA== X-Gm-Gg: AZuq6aKaPkYEw+lqNFeujbk3Vp2LTVF3/cjR3KXhZtM1aToXG1jHLeS7HCIcrPdUAOP zFoRB9kmxO/wSb7lBV447WVwPC3gy7hEpfDSLKGlLUtQ1/0a8b85HMm2hr+xdTtVJETtkgsjrQy hRFuRsgbUNAgV/lODSU6823vEIL3OnLSoQXvGgzrKlcyddHO7SKAr2xFMpGgFcUBfgVdgD3ehU5 NwyqYKPeJZHSK8DMoBFCgLB1lC8D88YqcpdNq1BHGaeCG5rTvtJuVHeNB0XQ9q3fyRP1hq61QXJ vO4qyVyf6UIAcGW4LvcG2HNwNH2VczeBMH6SLV2b2XD7V7kgJpVsUtsKUPnhsuIlViCTQpz45wS m5yu5e5qmA60d0mbMw2lijR7LFVz80x7WD1T9LX9jcGxX9515ffwrTKBeCAagJFg1fpnW3uX2EN PZFcgQJdKNIfVyjt6Q/r/KhMrZhQo/3Di+CMbqSJ5e7huBIkf5wYibqBIiFGk= X-Received: by 2002:a05:7022:b8d:b0:127:33e0:ea44 with SMTP id a92af1059eb24-1276ad1b5e8mr3297244c88.29.1771811087640; Sun, 22 Feb 2026 17:44:47 -0800 (PST) From: Lucas Amaral To: devel@lists.libvirt.org Subject: [PATCH] storage: mpath: fix error reporting in virStorageBackendGetMaps Date: Sun, 22 Feb 2026 22:44:42 -0300 Message-ID: <20260223014442.34708-1-lucaaamaral@gmail.com> X-Mailer: git-send-email 2.52.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: CBDVSV224TDYUOQQPWU7Z2IE4EKU4PHI X-Message-ID-Hash: CBDVSV224TDYUOQQPWU7Z2IE4EKU4PHI X-MailFrom: lucaaamaral@gmail.com 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: Lucas Amaral 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 @gmail.com) X-ZM-MESSAGEID: 1771811134901158500 Content-Type: text/plain; charset="utf-8" virStorageBackendGetMaps() returns 1 on failure instead of the conventional -1, and does not call virReportError() in any of its error paths. On top of that, both callers silently discard the return value: virStorageBackendGetMaps() ignores the result of virStorageBackendCreateVols(), and virStorageBackendMpathRefreshPool() ignores the result of virStorageBackendGetMaps(). Fix all three issues: normalize error returns to -1, add virReportError() calls for each failure path in virStorageBackendGetMaps(), and check return values in both callers so that errors are properly propagated. Signed-off-by: Lucas Amaral --- This is similar in spirit to commits e9b931d3e4 ("virpci: Report an error if virPCIGetVirtualFunctionIndex() fails") and 6c2c9e21ac ("virstorageobj: Make virStoragePoolObjAddVol() report an error on failure"), applying the same pattern to the mpath storage backend. Found while auditing storage backends for functions that return error codes without calling virReportError(). src/storage/storage_backend_mpath.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/storage/storage_backend_mpath.c b/src/storage/storage_back= end_mpath.c index 9fc3983c52..a30153a93b 100644 --- a/src/storage/storage_backend_mpath.c +++ b/src/storage/storage_backend_mpath.c @@ -197,19 +197,25 @@ virStorageBackendGetMaps(virStoragePoolObj *pool) struct dm_names *names =3D NULL; =20 if (!(dmt =3D dm_task_create(DM_DEVICE_LIST))) { - retval =3D 1; + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Failed to create devmapper task")); + retval =3D -1; goto out; } =20 dm_task_no_open_count(dmt); =20 if (!dm_task_run(dmt)) { - retval =3D 1; + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Failed to run devmapper task")); + retval =3D -1; goto out; } =20 if (!(names =3D dm_task_get_names(dmt))) { - retval =3D 1; + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Failed to get devmapper device names")); + retval =3D -1; goto out; } =20 @@ -218,7 +224,10 @@ virStorageBackendGetMaps(virStoragePoolObj *pool) goto out; } =20 - virStorageBackendCreateVols(pool, names); + if (virStorageBackendCreateVols(pool, names) < 0) { + retval =3D -1; + goto out; + } =20 out: if (dmt !=3D NULL) @@ -248,7 +257,8 @@ virStorageBackendMpathRefreshPool(virStoragePoolObj *po= ol) =20 virWaitForDevices(); =20 - virStorageBackendGetMaps(pool); + if (virStorageBackendGetMaps(pool) < 0) + return -1; =20 return 0; } --=20 2.52.0