From nobody Thu Feb 29 16:12:30 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Tlx7y1k0cz5CS3q; Thu, 29 Feb 2024 16:12:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Tlx7y1GT6z4vw9; Thu, 29 Feb 2024 16:12:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709223150; h=from:from: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; bh=UybSWKi3A+FhWkTjK6Z5AFRwrxZKhWXzc5zfaEOKQNo=; b=jnqzqFlqd7ZxLqmkryUIIxDmcpLn5LeIfl28FMH0JTO1wiRs5tBTQoNj+GuDrgTu45Ng7r RLs/uoNI0Jv7jxJNtYZfAtRG4hbAYLeIDOY7G/9ecmvMO2MAmFOXB4l1iQL7vqQ34OuMLH dAoWXaNUHAltfzf3x6jvaKAM/ITUlYOiOHtl7KJkttBXxgwyYb0GPElQDrmQ09Oe03X4Op O2GIPyM+5BxY0/DQC/np2PsP6J7TXqfaKKOmEYjypS205GQ767y0qtArYzN095X+fJQlXQ PSFZNQwGyqFVWnXb4qDl0Ikn6SQam7+0VkDOZcfLcO2RTfc/Dp2dg/FtnLRPrA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1709223150; a=rsa-sha256; cv=none; b=hp8m5WcQ5xG2RycyimwQJ3Xq+ADT+DcWrejRpVrAjD0YUdB7qP8joHbGkfZB1DYI2VP1PF Owd60YNxm9Fmi/dr4XRRqQmX/wWsRobnwo51oKylx1+WmFb9DI8hqZTjAFTXS+u07cXhw8 8ajEOVNpQ+0QLm18tjy6XigsJIwEmupoaJtiNtxnL4suc+KgONcUBZ8a1KIEqVtzT8x7px OAEeR84fqW+pjUlEQDXvA7TXsCtiiY2RtKkpZQIzUNEQJH/T6H1Q9qeMydXnbh6PT3lhwT zi9/CSdyFLdrhp4x1sFag592WC65nIBD3I+fIhVutQowPtGqeu92aaZ5yJbRQg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709223150; h=from:from: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; bh=UybSWKi3A+FhWkTjK6Z5AFRwrxZKhWXzc5zfaEOKQNo=; b=ddvcRaFMsFrjR6SXy05aTqzR3iDr66yVdyIdwL/ruaOi5h28VP1sVkRSrSr7DqP2PvWp9i TRQ/bhma4AZmqYzgR8EwKXUuPQqivM3rcu/6qe08ytg8rRmucZw6hG7ihCl5DmWaKPnXMp /KQ99bgJWp+zPC5V6mL+IGJb7lQuLVwEG1lnDN/bT7Uhd1DvLQKR4uBBYZLFjI0rZPsU5D +TU+PfGLanBsoqE4l4w6+C5nviq8zPQWi6IxB2rggDwN5KHNrYkbv8aasbpl26sP//itQA 1W0ZjrHHiSoL0+Bbs1eWShOgCCrKkG0iQwNPdRI5gWqCo2CuVGORpXR8I2vakg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Tlx7y0tgczpZB; Thu, 29 Feb 2024 16:12:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 41TGCUxj007032; Thu, 29 Feb 2024 16:12:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41TGCUJe007029; Thu, 29 Feb 2024 16:12:30 GMT (envelope-from git) Date: Thu, 29 Feb 2024 16:12:30 GMT Message-Id: <202402291612.41TGCUJe007029@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 525e6d6c890f - main - loader/zfs: Fix to actually return the last error List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 525e6d6c890f6aee898ac70347e5bb49da6638a1 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=525e6d6c890f6aee898ac70347e5bb49da6638a1 commit 525e6d6c890f6aee898ac70347e5bb49da6638a1 Author: Warner Losh AuthorDate: 2024-02-27 05:47:38 +0000 Commit: Warner Losh CommitDate: 2024-02-29 16:12:21 +0000 loader/zfs: Fix to actually return the last error The last fix, to try to return the last error, really returns the first return code after the last error, which could be zero. Instead, return the last error. Also, change rc to err to make it visually distinct from rv, which is the cause of my error in e54bb0ad8058. Reported by: Bill Sommerfeld Fixes: e54bb0ad8058 Sponsored by: Netflix --- stand/libsa/zfs/zfsimpl.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/stand/libsa/zfs/zfsimpl.c b/stand/libsa/zfs/zfsimpl.c index e37582006c7a..41ef5a46f30e 100644 --- a/stand/libsa/zfs/zfsimpl.c +++ b/stand/libsa/zfs/zfsimpl.c @@ -1681,14 +1681,14 @@ static int vdev_write_bootenv_impl(vdev_t *vdev, vdev_boot_envblock_t *be) { vdev_t *kid; - int rv = 0, rc; + int rv = 0, err; STAILQ_FOREACH(kid, &vdev->v_children, v_childlink) { if (kid->v_state != VDEV_STATE_HEALTHY) continue; - rc = vdev_write_bootenv_impl(kid, be); - if (rv != 0) - rv = rc; + err = vdev_write_bootenv_impl(kid, be); + if (err != 0) + rv = err; } /* @@ -1698,12 +1698,12 @@ vdev_write_bootenv_impl(vdev_t *vdev, vdev_boot_envblock_t *be) return (rv); for (int l = 0; l < VDEV_LABELS; l++) { - rc = vdev_label_write(vdev, l, be, + err = vdev_label_write(vdev, l, be, offsetof(vdev_label_t, vl_be)); - if (rc != 0) { + if (err != 0) { printf("failed to write bootenv to %s label %d: %d\n", - vdev->v_name ? vdev->v_name : "unknown", l, rc); - rv = rc; + vdev->v_name ? vdev->v_name : "unknown", l, err); + rv = err; } } return (rv);