From nobody Tue Apr 16 20:13:04 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 4VJwFs4JCzz5H0bM; Tue, 16 Apr 2024 20:13:05 +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 4VJwFs0J2Vz4tMn; Tue, 16 Apr 2024 20:13:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713298385; 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=6dhLpnoKyDShCDVaXpaol6B7RkdcUmTTspoY1Zrok3g=; b=M+CGxgvfy/rfrOGmD87XcPwpkqebqJLNeioomwRiBOpPzbfpY3rOhN98YynaqWf54MqqvB k1Y13C70aRYyQGS+D8wrzV4hGU2YwrCk4uL/Lj5HtuXHDzrdl9MJnNk7XNsv0hjMOm/qH8 eEcDSM+NPlWMI4/MAdsQ2wi0+s6su8eDL7QTBjFcbzQrpPoQGDRcYcZ4Hg1tPSBbBGuA4N E9VUeruOPEby1j9Y9dO/oOargdkV0AIXfHMAoxKIx5rDVczl5gEf/zBzxExOQzQk1H29pK vP5POVOAibntJAU+KmcfvHmDnEknOWUR5+NJ6ixOB6Cq2mTqhDLmKvUGksU2xw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713298385; a=rsa-sha256; cv=none; b=QGoBdIsyQo1J5FA/eCptkskbnsoynCim1lJIiBopxF525IEzgKUZFwoVVEpAbMheKefN+6 1QDtSkRE3Bfg/43nb7tJUI2jS1V41Ggxx1JemNq7ijkeXKNi1JkFjtfki6hL5+5NVRZQSD Asz5pDsArvgcQmpK/36bUtVISDde4Ye2r9elDoPRv2KGyE6HXI+fM3gz13Db+ybbJUIbge RoEnNhHZjKzOWMBgt1fp3UHC8uaUALOacIeZ408knDiDoVJd/5Szd8EuF1rWvTCiarY0QI tfi630Dsqtc95Z0cejduu44bk7rOIzITD7W91suw9qhV9CVhio5w5SVoceWvrw== 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=1713298385; 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=6dhLpnoKyDShCDVaXpaol6B7RkdcUmTTspoY1Zrok3g=; b=rjJbM6yAK4L//fXBcU4mVfZnnhItgh+QKI2OSXKHGhOytNjKWHp/GZ5c5Ayt/EPmROCe1m E9sCzVhs5oxzBvj5kRKHELxnElSsZpd6olOF0hb5KKE3zOeo8ZCZ4b2sSPrBg9ZN8vYyaX Cao8kORiIrFb89g1C/hex9ZfMJZdUIbESz6GlyGFQL0dlAoXiSZumJlBu1Q58kInR4CgWU YZEkBb+xa0eCW0IeCuXJTQEuWUwaeGa6x/11fsGVw06ruv30cNJKWbfSse70fOYPE8RMYD rJfxWiGxZWphI1x9D+yMsnxN8l1AKXnGksl0M4NCFNryGndrr75WB7Z0GUZ4zA== 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 4VJwFr6x9dzxWS; Tue, 16 Apr 2024 20:13:04 +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 43GKD4Kw038674; Tue, 16 Apr 2024 20:13:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43GKD423038671; Tue, 16 Apr 2024 20:13:04 GMT (envelope-from git) Date: Tue, 16 Apr 2024 20:13:04 GMT Message-Id: <202404162013.43GKD423038671@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: c3f5ae85ceda - stable/14 - kboot: Fix zfs bootonce protocol 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: c3f5ae85ceda88473c1b8fc671284e467bd37ce8 Auto-Submitted: auto-generated The branch stable/14 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=c3f5ae85ceda88473c1b8fc671284e467bd37ce8 commit c3f5ae85ceda88473c1b8fc671284e467bd37ce8 Author: Warner Losh AuthorDate: 2024-02-21 03:26:08 +0000 Commit: Warner Losh CommitDate: 2024-04-16 19:54:26 +0000 kboot: Fix zfs bootonce protocol This wasn't updated when the other copies were updated. Make it identical to efi code. We should likely refactor this (with userboot), but they are all not quite identical. Sponsored by: Netflix (cherry picked from commit 65ee8f90b7906a5895c87bfe05f85ce3d3bf84c7) --- stand/kboot/kboot/hostdisk.c | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/stand/kboot/kboot/hostdisk.c b/stand/kboot/kboot/hostdisk.c index 552ae68daced..423151983523 100644 --- a/stand/kboot/kboot/hostdisk.c +++ b/stand/kboot/kboot/hostdisk.c @@ -567,40 +567,35 @@ hostdisk_zfs_probe(void) /* This likely shoud move to libsa/zfs/zfs.c and be used by at least EFI booting */ static bool -probe_zfs_currdev(uint64_t pool_guid, uint64_t root_guid, bool setcurrdev) +probe_zfs_currdev(uint64_t pool_guid) { char *devname; struct zfs_devdesc currdev; - bool bootable; + char buf[VDEV_PAD_SIZE]; currdev.dd.d_dev = &zfs_dev; currdev.dd.d_unit = 0; currdev.pool_guid = pool_guid; - currdev.root_guid = root_guid; + currdev.root_guid = 0; devname = devformat(&currdev.dd); - if (setcurrdev) - set_currdev(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); - if (setcurrdev) - set_currdev(buf); - setenv("zfs-bootonce", buf, 1); - } - (void)zfs_attach_nvstore(&currdev); - init_zfs_boot_options(devname); + printf("Setting currdev to %s\n", devname); + set_currdev(devname); + init_zfs_boot_options(devname); + + 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); } - return (bootable); + (void)zfs_attach_nvstore(&currdev); + + return (sanity_check_currdev()); } static bool hostdisk_zfs_try_default(hdinfo_t *hd) { - return (probe_zfs_currdev(hd->hd_zfs_uuid, 0, true)); + return (probe_zfs_currdev(hd->hd_zfs_uuid)); } bool