summaryrefslogtreecommitdiff
path: root/lib/libbe/be.c
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2018-11-12 16:41:41 +0000
committerDimitry Andric <dim@FreeBSD.org>2018-11-12 16:41:41 +0000
commit9b5cb2f639cc6e119a8433e2db6858e4ccab24b4 (patch)
tree5ca0f0db6479a7035932c908442c432add45b234 /lib/libbe/be.c
parent8c1538224adf39b7486c5f4d0c0f18317f60f157 (diff)
parent389474c122a3863189f5cebefd0620723ae143dc (diff)
Notes
Diffstat (limited to 'lib/libbe/be.c')
-rw-r--r--lib/libbe/be.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/libbe/be.c b/lib/libbe/be.c
index 10977747a670..540fe44ea1e9 100644
--- a/lib/libbe/be.c
+++ b/lib/libbe/be.c
@@ -922,6 +922,21 @@ be_set_nextboot(libbe_handle_t *lbh, nvlist_t *config, uint64_t pool_guid,
return (0);
}
+/*
+ * Deactivate old BE dataset; currently just sets canmount=noauto
+ */
+static int
+be_deactivate(libbe_handle_t *lbh, const char *ds)
+{
+ zfs_handle_t *zfs;
+
+ if ((zfs = zfs_open(lbh->lzh, ds, ZFS_TYPE_DATASET)) == NULL)
+ return (1);
+ if (zfs_prop_set(zfs, "canmount", "noauto") != 0)
+ return (1);
+ zfs_close(zfs);
+ return (0);
+}
int
be_activate(libbe_handle_t *lbh, const char *bootenv, bool temporary)
@@ -961,6 +976,9 @@ be_activate(libbe_handle_t *lbh, const char *bootenv, bool temporary)
return (be_set_nextboot(lbh, vdevs, pool_guid, buf));
} else {
+ if (be_deactivate(lbh, lbh->bootfs) != 0)
+ return (-1);
+
/* Obtain bootenv zpool */
err = zpool_set_prop(lbh->active_phandle, "bootfs", be_path);
if (err)