From nobody Fri Apr 26 05:00:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1610110852; cv=none; d=zohomail.com; s=zohoarc; b=AwFyw0ulyf1YXYoxkzPv/rVg2he7LpP2CEdIYeduSnDS/TwCzqFmLtS9/uPMA4L7ulAwP0Ebv8IlfZuwggep7QwSVIG7PO5mk5dFDZ97Ky+MnS4dBIqKk66li7A2sOzLltr7WPlMPiIiEXIJcFBJCgyDS+UoXBmZLXaXJzz/+TA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610110852; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=yEfQJgnNoFrCciM4j1YKUATbfBy1U/Xrd03wabk9/VY=; b=LPTIEjv0t4dLPlcjiShH8EIMgo77JsDqOL3DGp5j0Ea3xzV3tXT03Ki1E4frroSgIVKyu1BLJoHzcpGmUGU/MABKHwPEYOT5IT53iyRUHFStp8f7M8WahMHzNrBPVA+sF1stdZ+XfZt3i2HE9JXWtNxijgxvm4m7Oy6zNwYZAtw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1610110852786913.661945859888; Fri, 8 Jan 2021 05:00:52 -0800 (PST) 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-190-sXwCdphPMCCgIyuTHt6piw-1; Fri, 08 Jan 2021 08:00:48 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 12ED89CDA0; Fri, 8 Jan 2021 13:00:42 +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 B31F4629DB; Fri, 8 Jan 2021 13:00:41 +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 500AF44A66; Fri, 8 Jan 2021 13:00:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 108D0cg5029298 for ; Fri, 8 Jan 2021 08:00:38 -0500 Received: by smtp.corp.redhat.com (Postfix) id C71BE5D9E3; Fri, 8 Jan 2021 13:00:38 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4F8635D9E2 for ; Fri, 8 Jan 2021 13:00:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610110851; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=yEfQJgnNoFrCciM4j1YKUATbfBy1U/Xrd03wabk9/VY=; b=UgZRZssyCBrbOXEUOA8s/yOzyAEnfz/QbntphT6a0KdFgkbMg2Wvsf5XJPyZ/v4hV+YrGf TPg9Sg37fgWepTK5g0W+X9Dvo0D2M6uOCJg0fOrcpft8cW8pPlUYmo8ZakG8hOl2u2rq5n rrRoJazlowrulzqiVrDCx+pyrcoKCZ0= X-MC-Unique: sXwCdphPMCCgIyuTHt6piw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH] Revert "storage: volStorageBackendRBDRefreshVolInfo: refactor" Date: Fri, 8 Jan 2021 14:00:02 +0100 Message-Id: <1208083261407aed5ab62bd4ed6c4db780ecbd53.1610110801.git.jtomko@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Only set 'ret' once in any given execution path instead of mixing it with intermediate return values. This reverts commit 453bdebe5dcc3ec87d4db011e4f657fa24e42d94 Signed-off-by: J=C3=A1n Tomko --- src/storage/storage_backend_rbd.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backen= d_rbd.c index 22f5c78591..1630d6eede 100644 --- a/src/storage/storage_backend_rbd.c +++ b/src/storage/storage_backend_rbd.c @@ -507,30 +507,36 @@ volStorageBackendRBDRefreshVolInfo(virStorageVolDefPt= r vol, virStoragePoolObjPtr pool, virStorageBackendRBDStatePtr ptr) { - int ret =3D -1; + int rc, ret =3D -1; virStoragePoolDefPtr def =3D virStoragePoolObjGetDef(pool); rbd_image_t image =3D NULL; rbd_image_info_t info; uint64_t features; uint64_t flags; =20 - if ((ret =3D rbd_open_read_only(ptr->ioctx, vol->name, &image, NULL)) = < 0) { + if ((rc =3D rbd_open_read_only(ptr->ioctx, vol->name, &image, NULL)) <= 0) { + ret =3D rc; virReportSystemError(errno, _("failed to open the RBD image '%s'"), vol->name); goto cleanup; } =20 - if ((ret =3D rbd_stat(image, &info, sizeof(info))) < 0) { + if ((rc =3D rbd_stat(image, &info, sizeof(info))) < 0) { + ret =3D rc; virReportSystemError(errno, _("failed to stat the RBD image '%s'"), vol->name); goto cleanup; } =20 - if ((ret =3D volStorageBackendRBDGetFeatures(image, vol->name, &featur= es)) < 0) + if ((rc =3D volStorageBackendRBDGetFeatures(image, vol->name, &feature= s)) < 0) { + ret =3D rc; goto cleanup; + } =20 - if ((ret =3D volStorageBackendRBDGetFlags(image, vol->name, &flags)) <= 0) + if ((rc =3D volStorageBackendRBDGetFlags(image, vol->name, &flags)) < = 0) { + ret =3D rc; goto cleanup; + } =20 vol->target.capacity =3D info.size; vol->type =3D VIR_STORAGE_VOL_NETWORK; @@ -543,8 +549,10 @@ volStorageBackendRBDRefreshVolInfo(virStorageVolDefPtr= vol, "Querying for actual allocation", def->source.name, vol->name); =20 - if ((ret =3D virStorageBackendRBDSetAllocation(vol, image, &info))= < 0) + if ((rc =3D virStorageBackendRBDSetAllocation(vol, image, &info)) = < 0) { + ret =3D rc; goto cleanup; + } } else { vol->target.allocation =3D info.obj_size * info.num_objs; } @@ -560,6 +568,8 @@ volStorageBackendRBDRefreshVolInfo(virStorageVolDefPtr = vol, VIR_FREE(vol->key); vol->key =3D g_strdup_printf("%s/%s", def->source.name, vol->name); =20 + ret =3D 0; + cleanup: if (image) rbd_close(image); --=20 2.26.2