diff options
author | Dan McDonald <danmcd@joyent.com> | 2021-01-20 10:46:23 -0500 |
---|---|---|
committer | Dan McDonald <danmcd@joyent.com> | 2021-01-20 10:46:23 -0500 |
commit | c85996c970d16f2bbde7e025b3f18fdaef5a2e71 (patch) | |
tree | 935eea5cba80972827e1fd528ab3d3cec4e7295d /usr/src/lib/libbe/common/be_create.c | |
parent | 4b15627ff0a1429ed6b071009361c2ec6cc3de5d (diff) | |
parent | 0b35c8bcd86de836ba2ab241e3b4ac7955c4148c (diff) | |
download | illumos-joyent-c85996c970d16f2bbde7e025b3f18fdaef5a2e71.tar.gz |
[illumos-gate merge]
commit 0b35c8bcd86de836ba2ab241e3b4ac7955c4148c
13424 unix: multiply-defined symbols
commit f976337ad91e7232287bf3bc0e038987a11a8949
13451 beadm needs to do more with temporary BE activation
commit ee6e522102d701504922a982938c5873c599b3ff
13422 ufs: symbol 'iuniqtime' is multiply-defined
Diffstat (limited to 'usr/src/lib/libbe/common/be_create.c')
-rw-r--r-- | usr/src/lib/libbe/common/be_create.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/usr/src/lib/libbe/common/be_create.c b/usr/src/lib/libbe/common/be_create.c index 4c69ac38f6..4158ddb677 100644 --- a/usr/src/lib/libbe/common/be_create.c +++ b/usr/src/lib/libbe/common/be_create.c @@ -24,7 +24,7 @@ * Copyright 2013 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2014, 2015 by Delphix. All rights reserved. * Copyright (c) 2016 Martin Matuska. All rights reserved. - * Copyright 2019 OmniOS Community Edition (OmniOSce) Association. + * Copyright 2021 OmniOS Community Edition (OmniOSce) Association. */ /* @@ -50,6 +50,7 @@ #include <libbe.h> #include <libbe_priv.h> +#include <libzfsbootenv.h> /* Library wide variables */ libzfs_handle_t *g_zfs = NULL; @@ -472,6 +473,28 @@ be_destroy(nvlist_t *be_attrs) } } + /* + * Detect if the BE to destroy is referenced in the pool's nextboot + * field, and unset it if so. + */ + if (getzoneid() == GLOBAL_ZONEID) { + char *nextboot = NULL; + + if (lzbe_get_boot_device(bt.obe_zpool, &nextboot) == 0 && + nextboot != NULL && strcmp(nextboot, bt.obe_root_ds) == 0) { + if (lzbe_set_boot_device(bt.obe_zpool, + lzbe_add, "") != 0) { + be_print_err(gettext("be_destroy: failed to " + "remove temporary activation for " + "dataset %s on pool %s\n"), + bt.obe_root_ds, bt.obe_zpool); + free(nextboot); + return (BE_ERR_UNKNOWN); + } + } + free(nextboot); + } + /* Get handle to BE's root dataset */ if ((zhp = zfs_open(g_zfs, bt.obe_root_ds, ZFS_TYPE_FILESYSTEM)) == NULL) { |