When be_activate() turns on a new boot environment, it always deactivates

the current one first. And if it fails to do so, it abandons activation.
However, with the new bootonce feature, there is a legitimate case when
a pool doesn't have "bootfs" property set. Check for this case before
calling be_deactivate().

Reviewed by:	kevans
This commit is contained in:
Gleb Smirnoff 2021-01-08 09:23:16 -08:00
parent 14a16fd3e7
commit 7edc1bd9dc

View File

@ -1263,7 +1263,8 @@ be_activate(libbe_handle_t *lbh, const char *bootenv, bool temporary)
return (lzbe_set_boot_device( return (lzbe_set_boot_device(
zpool_get_name(lbh->active_phandle), lzbe_add, be_path)); zpool_get_name(lbh->active_phandle), lzbe_add, be_path));
} else { } else {
if (be_deactivate(lbh, lbh->bootfs, false) != 0) if (strncmp(lbh->bootfs, "-", 1) != 0 &&
be_deactivate(lbh, lbh->bootfs, false) != 0)
return (-1); return (-1);
/* Obtain bootenv zpool */ /* Obtain bootenv zpool */