libbe(3): Don't promote non-cloned BEs
Most easily reproducible by attempting to activate the currently activated BE, one would get a "not a cloned filesystem" error instead of success or a sane message. PR: 232488 MFC after: 3 days
This commit is contained in:
parent
c658866914
commit
4635676d25
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=339994
@ -928,7 +928,8 @@ be_activate(libbe_handle_t *lbh, const char *bootenv, bool temporary)
|
|||||||
{
|
{
|
||||||
char be_path[BE_MAXPATHLEN];
|
char be_path[BE_MAXPATHLEN];
|
||||||
char buf[BE_MAXPATHLEN];
|
char buf[BE_MAXPATHLEN];
|
||||||
nvlist_t *config, *vdevs;
|
nvlist_t *config, *dsprops, *vdevs;
|
||||||
|
char *origin;
|
||||||
uint64_t pool_guid;
|
uint64_t pool_guid;
|
||||||
zfs_handle_t *zhp;
|
zfs_handle_t *zhp;
|
||||||
int err;
|
int err;
|
||||||
@ -969,7 +970,18 @@ be_activate(libbe_handle_t *lbh, const char *bootenv, bool temporary)
|
|||||||
if (zhp == NULL)
|
if (zhp == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
|
if (be_prop_list_alloc(&dsprops) != 0)
|
||||||
|
return (-1);
|
||||||
|
|
||||||
|
if (be_get_dataset_props(lbh, be_path, dsprops) != 0) {
|
||||||
|
nvlist_free(dsprops);
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nvlist_lookup_string(dsprops, "origin", &origin) == 0)
|
||||||
err = zfs_promote(zhp);
|
err = zfs_promote(zhp);
|
||||||
|
nvlist_free(dsprops);
|
||||||
|
|
||||||
zfs_close(zhp);
|
zfs_close(zhp);
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
|
Loading…
Reference in New Issue
Block a user