From nobody Fri Feb 27 01:01:54 2026 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 4fMVQp3zzyz6Swgt for ; Fri, 27 Feb 2026 01:01:54 +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 "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fMVQp3Fbwz3p83 for ; Fri, 27 Feb 2026 01:01:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1772154114; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=L53YHYAEB14kUwTTswOkmmvh2dAfCHRo0J/VLKcMDGY=; b=f8K28iaW1kw5TmHs0TCTXcTewp4wewlpHUKiga0uHX21LruHIaw+T8HgkXW59xg5VGxh+d drUi76hY1Bs8YCzlsKT3qYhQKk3dV1Sg/Wc3C0Nte9L9Tl+T9G/bO2R3yhxwuI/HzcVR4H uCcbNnVTRhTnLKKvfxamLMdJiaoqPxLIDp04Ed7DLOaBQXa7cUTlBwUzTfRxkzZzSVmHrx k7chDEzJ4DSK6PdHRnrl9pO811AMYrZaScUDGkFAihNJvfaWTgFyN1Kwpe92YtKF338Qdd Un0S1jJdrEcOt943cqnLpUURpOm31v64oUq80r/Cxiu+5PRyiI5ci9U/P/U/sw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1772154114; a=rsa-sha256; cv=none; b=FWOUSCfU+RS7Ef1vxFsitScee5D2+gefy5kfAIXP4kqxGrRYKynvbcgUs4ODkx3bK5TmxA T/2O1HFvg0vXzYcT86QmdB2p4S/EzKWrE+qdJEACnTLyVLrLgLGo/fb5NF4QFA8Xm3iaGW SWxPqMXhZNz9ZotOWHTz2vkateB217fD0Pt35pmF9uxp2tyqiwkwbByZ1ZsDsgDh7zHcom qxD2LUwcayzt2PFFU/mkvLYgAQxQhAxeAmun3XODimsNu9TQIbNZyrRXBM6DAnDmrqQNOI nJAKaouSqVeHYeOkLD0qzUF5zRZ/PK7MjTZMagNiQFoFfow+dHnLAEoS0snmfg== 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=1772154114; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=L53YHYAEB14kUwTTswOkmmvh2dAfCHRo0J/VLKcMDGY=; b=OU9/tkvk7Uz3ayw28cN23BY2SKYKdMkQDRehzVj+DwWRdQvtZFptCQFbyApFbftEl2JfPz 0NQbPgxxisducLmlE3gMAjyCZTe5I8JycCaZj5bUWyEvcW+Jlgfuopr/sPoxlM+oZ1ZI5V SI6rdEoGKjZFOvxlE9zSQ3JsbqnUmpfv/a/eoZnt7+bpM/xsh5/VZcpmZp8TubUDK04roJ yLKVo7ROpp2tby/4iD5xeo7MsOwNTZSAXLJE9OFt8fh89o7SJa6PKunczioGbxK3a/y3qt ZnDKI9GvfCY7wSs9eF0eQMwOH7+hCyZfVYZgi20Q6E4qwrl+4IWXFgoyMAg1VQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fMVQp2nFvzwd9 for ; Fri, 27 Feb 2026 01:01:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 47d7a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 27 Feb 2026 01:01:54 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Gleb Smirnoff From: Warner Losh Subject: git: d69fc3a9dc71 - main - loader.efi: try all ZFS pools found by efi_zfs_probe() 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-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: d69fc3a9dc71768e125e83d35274f0820063e42d Auto-Submitted: auto-generated Date: Fri, 27 Feb 2026 01:01:54 +0000 Message-Id: <69a0ed02.47d7a.427b6404@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d69fc3a9dc71768e125e83d35274f0820063e42d commit d69fc3a9dc71768e125e83d35274f0820063e42d Author: Gleb Smirnoff AuthorDate: 2026-02-27 00:57:26 +0000 Commit: Warner Losh CommitDate: 2026-02-27 01:01:36 +0000 loader.efi: try all ZFS pools found by efi_zfs_probe() Remove global uint64_t pool_guid and instead iterate over all pools that efizfs_get_zfsinfo_list() provides. The global pool_guid used to mark that we have constructed a ZFS pool and the pool label that was used for that was stored on a partition that is the EFI image device handle. First problem here is that it is too restrictive. If the very first device to probe is a spare member of a pool, it will be used to instantiate a pool but (pd->pd_handle == boot_img->DeviceHandle) won't be true, thus global pool_guid won't be populated and ZFS boot won't be tried. Second problem is that potentially we may find several pools, and all should be tried to boot. Note that the code for that is already here - efizfs_get_zfsinfo_list() is imported by efizfs.h but was not used until now. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D55094 --- stand/efi/include/efizfs.h | 2 -- stand/efi/libefi/efizfs.c | 9 +-------- stand/efi/loader/main.c | 9 ++++++--- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/stand/efi/include/efizfs.h b/stand/efi/include/efizfs.h index 45c2ca1c94aa..5f50b7740a55 100644 --- a/stand/efi/include/efizfs.h +++ b/stand/efi/include/efizfs.h @@ -49,8 +49,6 @@ typedef struct zfsinfo uint64_t zi_pool_guid; } zfsinfo_t; -extern uint64_t pool_guid; - void efi_zfs_probe(void); EFI_HANDLE efizfs_get_handle_by_guid(uint64_t); bool efizfs_get_guid_by_handle(EFI_HANDLE, uint64_t *); diff --git a/stand/efi/libefi/efizfs.c b/stand/efi/libefi/efizfs.c index 1c80f1ae26b9..563cf841143a 100644 --- a/stand/efi/libefi/efizfs.c +++ b/stand/efi/libefi/efizfs.c @@ -40,8 +40,6 @@ #ifdef EFI_ZFS_BOOT static zfsinfo_list_t zfsinfo; -uint64_t pool_guid; - zfsinfo_list_t * efizfs_get_zfsinfo_list(void) { @@ -111,13 +109,8 @@ efi_zfs_probe(void) STAILQ_FOREACH(pd, &hd->pd_part, pd_link) { snprintf(devname, sizeof(devname), "%s%dp%d:", efipart_hddev.dv_name, hd->pd_unit, pd->pd_unit); - guid = 0; - if (zfs_probe_dev(devname, &guid, false) == 0) { + if (zfs_probe_dev(devname, &guid, false) == 0) insert_zfs(pd->pd_handle, guid); - if (pd->pd_handle == boot_img->DeviceHandle) - pool_guid = guid; - } - } } } diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c index 7ff2cf188509..d8508d7d91a0 100644 --- a/stand/efi/loader/main.c +++ b/stand/efi/loader/main.c @@ -588,6 +588,9 @@ find_currdev(bool do_bootmgr, char *boot_info, size_t boot_info_sz) } #ifdef EFI_ZFS_BOOT + zfsinfo_list_t *zfsinfo = efizfs_get_zfsinfo_list(); + zfsinfo_t *zi; + /* * Did efi_zfs_probe() detect the boot pool? If so, use the zpool * it found, if it's sane. ZFS is the only thing that looks for @@ -595,9 +598,9 @@ find_currdev(bool do_bootmgr, char *boot_info, size_t boot_info_sz) * if we allow specifying which pool to boot from via UEFI variables * rather than the bootenv stuff that FreeBSD uses today. */ - if (pool_guid != 0) { - printf("Trying ZFS pool\n"); - if (probe_zfs_currdev(pool_guid)) + STAILQ_FOREACH(zi, zfsinfo, zi_link) { + printf("Trying ZFS pool 0x%jx\n", zi->zi_pool_guid); + if (probe_zfs_currdev(zi->zi_pool_guid)) return (0); } #endif /* EFI_ZFS_BOOT */