From nobody Thu Jun 08 18:14:58 2023 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 4QcXS307P7z4cGLN; Thu, 8 Jun 2023 18:14:59 +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 4QcXS26k0Gz410x; Thu, 8 Jun 2023 18:14:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686248098; 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=VHptsBHsJpy3WWyMmXLEkTW1w671M9IGHxD0OYxZhy0=; b=floUnPvJIaGHOHF3Tcx3zo/06CsFGdbh7AB1fh0fVoyUdRJln4mXPxittpmUZQloPVJniq QTGDB8JIsBD0HKvc9xXm6WZFlrSVfmD5g3H1Vn4ZR/6gq4YWUeaKQnTBElywVpWNHtfY2c a9m7vxdv29DcGFJi6b7pcUS1MimdxC931gGeWLq+Sc9vfWIIiUH95LtzEtS1GQjvTW2YoT WpEm6D/1cLEQjeLTxEGeUT/sjlWGWgO213DxMCdFrEszprflS3MlTpOrM0kMEJoJxLtE2G UfRL6ujkaA8qRUnYL2NhOJC72LEKDN0SVJLDXQUsDbFhYEu3NUsbe2wjejNroA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686248098; 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=VHptsBHsJpy3WWyMmXLEkTW1w671M9IGHxD0OYxZhy0=; b=Kja3p/GFAVcniBiqStQS2syJ9NHbVKnpeYV+qAJfnK+Z0jI56BTLH5XBgpfxHVRJdPoY+h EJFeob+lRaEu/uoFAgCqhYPWJObpnSmnVhghMlMqafgwwyZWO/pOcoJHazbcpSm4b1KU2J kAH7VCSKxhSHhl9kruuoCTfiR3QNYNWHQekP0GNIMf/rgUrh+Ypvq2ZLoJA4WdqCtWUhc3 euoMz88/vVFSnn06h/QDxoJ5DNi6b/stkL+IaNFjvyUMfqzzkKrD+Kr53WksEKaHFOu4fR DZwoZyBbOeLrPvWhWGJ8GIbGUsCdT6HZ4rOd6lBdIbF0KVxIbbnvYsQKpRrpjg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686248098; a=rsa-sha256; cv=none; b=tcUzU9GlKm5kDX2oT7YfBF4lKdQ6BzEcbAw/74fA1QxC/r6f3iFRLN4ajZlDb/u0dD9dyu kvgaJUTLsiAseHEUM4rzRlkMPUlQ/XUmXpWKreMxw06itKLgk8AnCPjrsYyjR7j7QHoWUw Q2GI+uW4PnFQbA62hnIXE7g4P4Btneov0/UpqjwqXiPau8c4OXvnHG2xQOBK8JvA7Q2FGv O+qV9IFmjuG3T/vSOyEzoFbopVnDxcMonfLqRCv8SddMQX+8KMASIf7+HKygq2dlGhSGj4 yoaiZwaOL4eZRaT9/59R1nKT4NGNYvtDfbUmtvhHfAjrD+aDaf7LMEybMnw8tw== 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 4QcXS25mfmz14Hq; Thu, 8 Jun 2023 18:14:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 358IEwYr032159; Thu, 8 Jun 2023 18:14:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 358IEwDe032158; Thu, 8 Jun 2023 18:14:58 GMT (envelope-from git) Date: Thu, 8 Jun 2023 18:14:58 GMT Message-Id: <202306081814.358IEwDe032158@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: e3e2681d0ec2 - main - stand/loader.efi: read zfs bootonce attribute before checking currdev 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e3e2681d0ec28d6661fef6da76c9479049e2761c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=e3e2681d0ec28d6661fef6da76c9479049e2761c commit e3e2681d0ec28d6661fef6da76c9479049e2761c Author: Gleb Smirnoff AuthorDate: 2023-06-08 18:14:45 +0000 Commit: Gleb Smirnoff CommitDate: 2023-06-08 18:14:45 +0000 stand/loader.efi: read zfs bootonce attribute before checking currdev First check if bootonce is configured and if it is, then change currdev accordingly and after that do the sanity check. This fixes boot in a situation when ZFS pool doesn't have the "bootfs" property, but has bootonce attribute set. A strange, but legitimate case. Reviewed by: tsoome, imp Differential Revision: https://reviews.freebsd.org/D40388 --- stand/efi/loader/main.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c index 8419331f7a19..872f78ba82b2 100644 --- a/stand/efi/loader/main.c +++ b/stand/efi/loader/main.c @@ -250,9 +250,9 @@ sanity_check_currdev(void) static bool probe_zfs_currdev(uint64_t guid) { + char buf[VDEV_PAD_SIZE]; char *devname; struct zfs_devdesc currdev; - bool bootable; currdev.dd.d_dev = &zfs_dev; currdev.dd.d_unit = 0; @@ -262,19 +262,14 @@ probe_zfs_currdev(uint64_t guid) devname = devformat(&currdev.dd); init_zfs_boot_options(devname); - bootable = sanity_check_currdev(); - if (bootable) { - char buf[VDEV_PAD_SIZE]; - - if (zfs_get_bootonce(&currdev, OS_BOOTONCE, buf, sizeof(buf)) == 0) { - printf("zfs bootonce: %s\n", buf); - set_currdev(buf); - setenv("zfs-bootonce", buf, 1); - } + if (zfs_get_bootonce(&currdev, OS_BOOTONCE, buf, sizeof(buf)) == 0) { + printf("zfs bootonce: %s\n", buf); + set_currdev(buf); + setenv("zfs-bootonce", buf, 1); (void)zfs_attach_nvstore(&currdev); } - return (bootable); + return (sanity_check_currdev()); } #endif