git: c8842f1d18ae - main - Revert "loader.efi: Trim ZFS searching for other booting options"

From: Warner Losh <imp_at_FreeBSD.org>
Date: Fri, 10 Jul 2026 04:18:44 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=c8842f1d18ae136cf5e3144540f76c7ebe0cd28a

commit c8842f1d18ae136cf5e3144540f76c7ebe0cd28a
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2026-07-10 04:04:52 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2026-07-10 04:09:41 +0000

    Revert "loader.efi: Trim ZFS searching for other booting options"
    
    This reverts commit 3e3fd1fde8e168910edc538966111c0b5f03cd5f.
    
    This appears to break chainbooting with boot1.efi and similar scenarios
    with Root-on-ZFS scenarios. Revert until it's better understood.
    
    PR: 296309
    Sponsored by: Netflix
    Differential Revision:  https://reviews.freebsd.org/D58071
---
 stand/efi/loader/main.c | 30 ++++++++++++++++++++++++------
 1 file changed, 24 insertions(+), 6 deletions(-)

diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c
index cc7a9c4ac814..891ae198a13f 100644
--- a/stand/efi/loader/main.c
+++ b/stand/efi/loader/main.c
@@ -681,21 +681,39 @@ find_currdev(bool do_bootmgr, char *boot_info, size_t boot_info_sz)
 
 #ifdef EFI_ZFS_BOOT
 	/*
-	 * Sixth Choice: With a relaxed policy, try ZFS pools on non-boot
-	 * devices after the boot device has been fully exhausted.
+	 * Sixth Choice: Probe the boot disk for ZFS and then probe the non-boot
+	 * disk if we have a relaxed boot poluicy.
 	 */
-	if (boot_policy == RELAXED) {
+	{
 		zfsinfo_list_t *zfsinfo = efizfs_get_zfsinfo_list();
 		zfsinfo_t *zi;
 
+		/*
+		 * Try ZFS pool(s) on the boot device not reachable via
+		 * the partition walk above.
+		 */
 		STAILQ_FOREACH(zi, zfsinfo, zi_link) {
-			if (zi->zi_handle == boot_img->DeviceHandle)
+			if (zi->zi_handle != boot_img->DeviceHandle)
 				continue;
-			printf("Trying ZFS pool 0x%jx\n",
-			    zi->zi_pool_guid);
+			printf("Trying ZFS pool 0x%jx\n", zi->zi_pool_guid);
 			if (probe_zfs_currdev(zi->zi_pool_guid))
 				return (0);
 		}
+
+		/*
+		 * With a relaxed policy, try pools on other devices only
+		 * after the boot device has no bootable root.
+		 */
+		if (boot_policy == RELAXED) {
+			STAILQ_FOREACH(zi, zfsinfo, zi_link) {
+				if (zi->zi_handle == boot_img->DeviceHandle)
+					continue;
+				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 */