Skip to content

Commit

Permalink
When be_activate() turns on a new boot environment, it always deactiv…
Browse files Browse the repository at this point in the history
…ates

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
  • Loading branch information
glebius committed Jan 8, 2021
1 parent 14a16fd commit 7edc1bd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/libbe/be.c
Original file line number Diff line number Diff line change
Expand Up @@ -1263,7 +1263,8 @@ be_activate(libbe_handle_t *lbh, const char *bootenv, bool temporary)
return (lzbe_set_boot_device(
zpool_get_name(lbh->active_phandle), lzbe_add, be_path));
} else {
if (be_deactivate(lbh, lbh->bootfs, false) != 0)
if (strncmp(lbh->bootfs, "-", 1) != 0 &&
be_deactivate(lbh, lbh->bootfs, false) != 0)
return (-1);

/* Obtain bootenv zpool */
Expand Down

0 comments on commit 7edc1bd

Please sign in to comment.