Author: kevans Date: Mon Oct 1 14:57:33 2018 New Revision: 339047 URL: https://svnweb.freebsd.org/changeset/base/339047
Log: libbe(3): Fix BE activation promoting activated BE This allows older BEs to be destroyed as they become replaced by a BE created from them: e.g. bectl create -e brokenworld fixedworld bectl activate fixedworld bectl destroy brokenworld Submitted by: Shawn Webb Approved by: re (gjb) Obtained from: HardenedBSD (5948c0581e) Modified: head/lib/libbe/be.c Modified: head/lib/libbe/be.c ============================================================================== --- head/lib/libbe/be.c Mon Oct 1 14:47:49 2018 (r339046) +++ head/lib/libbe/be.c Mon Oct 1 14:57:33 2018 (r339047) @@ -928,8 +928,9 @@ be_activate(libbe_handle_t *lbh, const char *bootenv, { char be_path[BE_MAXPATHLEN]; char buf[BE_MAXPATHLEN]; - uint64_t pool_guid; nvlist_t *config, *vdevs; + uint64_t pool_guid; + zfs_handle_t *zhp; int err; be_root_concat(lbh, bootenv, be_path); @@ -961,14 +962,19 @@ be_activate(libbe_handle_t *lbh, const char *bootenv, } else { /* Obtain bootenv zpool */ err = zpool_set_prop(lbh->active_phandle, "bootfs", be_path); + if (err) + return (-1); - switch (err) { - case 0: - return (BE_ERR_SUCCESS); + zhp = zfs_open(lbh->lzh, be_path, ZFS_TYPE_FILESYSTEM); + if (zhp == NULL) + return (-1); - default: - /* XXX TODO correct errors */ + err = zfs_promote(zhp); + zfs_close(zhp); + + if (err) return (-1); - } } + + return (BE_ERR_SUCCESS); } _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"