aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2023-06-08 18:14:45 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2023-06-08 18:14:45 +0000
commite3e2681d0ec28d6661fef6da76c9479049e2761c (patch)
tree4e9fb20659f3df638ae75c719bea95aa2a51c1fe
parentdfa1982352ee312079b42ea49adcbc1da15722f7 (diff)
downloadsrc-e3e2681d0ec28d6661fef6da76c9479049e2761c.tar.gz
src-e3e2681d0ec28d6661fef6da76c9479049e2761c.zip
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
-rw-r--r--stand/efi/loader/main.c17
1 files 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