From nobody Tue Apr 16 20:13:09 2024 X-Original-To: dev-commits-src-all@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 4VJwFy1FZ1z5H0WX; Tue, 16 Apr 2024 20:13:10 +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 4VJwFx4ZDlz4tq9; Tue, 16 Apr 2024 20:13:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713298389; 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=wVcT/vM1MXNB8L2u8sw6uIxsx5pg0RhkJkpeuMZWewE=; b=bj3K7Vcm3vAgijVOSx1qi/WCxJ9vaZ4Fe0JX9qVby4vu58s/nAXcbBdaoTlzIMyYGykboG JgV00WaVXmOcCbOLQia7R8g1PUlcTKsil2USAmXMRsujDBLQGIsIyG66tpnBDQ5x8yDBWj +Be4ZhQqX2ZsPF6G9y0IXY5V9oGc6DUVEU/YD6J7f9p5Ki6iCihC85Cwz9yTE5nqy5Klfz KkCBYrb/9BbM2O30kGM7DMRvMU6Fhy0OqVqbJb02Kvxn6D36imsGw1+L1Ses+RKbvmKDWQ mFa39Swgs99tH4mFXXbvoM/lEPKy2oepX5PVqp63kOglsHRfQrDhFVyo507vAQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713298389; a=rsa-sha256; cv=none; b=KHo/+DA5lai6CFrC0B9bqVLBPebAu7LPIdNIltZ/gFuwJMosGkOWNWSFSu9b/DkPFvfDV7 1paOyCuO+N2+zrFFpxGYI77dxxkVNZdhEL0RW+Cvy1xcAKl7gIpEMewwc1gGXr6gQQzZQ2 nYMKe7FMNOf2miVuDJwhqV8x1LL3Aod+tA38+ywKz0hPjwF4s+Bih66SR29kEvZ0AmaJdX 3HGE+s+I6krfVGdFwic3NdqzyDVFOSUwyFHb+zVTz+XtAi8j26NzKkhb5EtpuDwyxH1lTy KJEOSGnvBXRZ9OIxY1yRzdK+Vo42vnmbRH7QwVAGk8ZMNCr/y6bVZkNtiWW/tg== 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=1713298389; 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=wVcT/vM1MXNB8L2u8sw6uIxsx5pg0RhkJkpeuMZWewE=; b=tjl9jqQTLi5YNcK83FYarL0PYrl3hmcTtbZUxmHsC0uy4TadLOh4cWJIretQ0ek7dN2q7W HtONJ97MhEkzmh1Le2rP5QoeZ8oh4pH18t1OLPvq8E4kk+I7CY50x3xkqPssYRVglHNwh/ 4FN/G6vOGuecesKQEGC7jIJEufSpVCqVDyLgm39eREyFar0jfXOXMe0MU8hUfNDzn1TGzF IkyVDcdMlIFGMjIErVp0G2sjI5JuDUUgyjlIsVXWxU3EjLfW3JGv4c3neAxXf+q1S41Baa 3emH9tVnYQxLCfmyUXmQYLaHj+iFNKc+yQ2dM9k+EU+/8MXeFBDKSlUMMIxeaA== 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 4VJwFx4BYZzxY5; Tue, 16 Apr 2024 20:13:09 +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 43GKD9rk038883; Tue, 16 Apr 2024 20:13:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43GKD9Q0038880; Tue, 16 Apr 2024 20:13:09 GMT (envelope-from git) Date: Tue, 16 Apr 2024 20:13:09 GMT Message-Id: <202404162013.43GKD9Q0038880@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 1ad22bbc04c7 - stable/14 - loader: return errors from writing ZFS labels List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/stable/14 X-Git-Reftype: branch X-Git-Commit: 1ad22bbc04c7094644135b2e22386e20b899b3ff Auto-Submitted: auto-generated The branch stable/14 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=1ad22bbc04c7094644135b2e22386e20b899b3ff commit 1ad22bbc04c7094644135b2e22386e20b899b3ff Author: Warner Losh AuthorDate: 2024-02-22 15:17:56 +0000 Commit: Warner Losh CommitDate: 2024-04-16 19:54:26 +0000 loader: return errors from writing ZFS labels vdev_write_bootenv_impl can only return success. Instead, return the last error. This will make any write errors more visible. The old code masked kboot's inability to write bootenv. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D44018 and 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 (cherry picked from commit e54bb0ad8058c0f84ceb08b49bb1d22af829a9e8) (cherry picked from commit 525e6d6c890f6aee898ac70347e5bb49da6638a1) --- 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 ed9c3753dd19..1b29c57a2ed1 100644 --- a/stand/libsa/zfs/zfsimpl.c +++ b/stand/libsa/zfs/zfsimpl.c @@ -1682,14 +1682,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; } /* @@ -1699,12 +1699,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);