Return call to init_zfs_bootenv to its previous location

When called to early, new_currdev->d_type was not yet set
zfs_fmtdev() would then return null

While here, guard call to init_zfs_bootenv with if d_type == DEVT_ZFS

Reported by:	tsoome at me.com
MFC after:	3 days
Sponsored by:	ScaleEngine Inc.
This commit is contained in:
Allan Jude 2016-01-09 19:13:25 +00:00
parent 64e9493420
commit d036e72f4b

View File

@ -262,7 +262,6 @@ extract_currdev(void)
new_currdev.d_kind.zfs.root_guid = 0;
}
new_currdev.d_dev = &zfs_dev;
init_zfs_bootenv(zfs_fmtdev(&new_currdev));
#endif
} else if ((initial_bootdev & B_MAGICMASK) != B_DEVMAGIC) {
/* The passed-in boot device is bad */
@ -296,6 +295,11 @@ extract_currdev(void)
new_currdev.d_unit = 0;
}
#ifdef LOADER_ZFS_SUPPORT
if (new_currdev.d_type == DEVT_ZFS)
init_zfs_bootenv(zfs_fmtdev(&new_currdev));
#endif
env_setenv("currdev", EV_VOLATILE, i386_fmtdev(&new_currdev),
i386_setcurrdev, env_nounset);
env_setenv("loaddev", EV_VOLATILE, i386_fmtdev(&new_currdev), env_noset,