Index: lib/libbe/be_access.c =================================================================== --- lib/libbe/be_access.c +++ lib/libbe/be_access.c @@ -210,7 +210,7 @@ if (info.name != NULL) { if (details != NULL) { - if ((root_hdl = zfs_open(lbh->lzh, lbh->root, + if ((root_hdl = zfs_open(lbh->lzh, info.name, ZFS_TYPE_FILESYSTEM)) == NULL) { free(info.name); return (BE_ERR_ZFSOPEN); @@ -218,7 +218,8 @@ propinfo.lbh = lbh; propinfo.list = details; - propinfo.single_object = false; + propinfo.single_object = true; + propinfo.bootonce = NULL; prop_list_builder_cb(root_hdl, &propinfo); zfs_close(root_hdl); } Index: sbin/bectl/bectl_jail.c =================================================================== --- sbin/bectl/bectl_jail.c +++ sbin/bectl/bectl_jail.c @@ -444,6 +444,7 @@ int bectl_cmd_unjail(int argc, char *argv[]) { + nvlist_t *belist; char path[MAXPATHLEN]; char *cmd, *name, *target; int jid; @@ -477,14 +478,27 @@ free(name); - if (be_mounted_at(be, path, NULL) != 0) { + bectl_jail_cleanup(path, jid); + + if (be_prop_list_alloc(&belist) != 0) { + fprintf(stderr, "bectl %s: failed to allocate prop nvlist\n", cmd); + return (1); + } + + if (be_mounted_at(be, path, belist) != 0) { fprintf(stderr, "bectl %s: jail requested by '%s' not a BE\n", cmd, target); return (1); } - bectl_jail_cleanup(path, jid); - be_unmount(be, target, 0); + nvlist_lookup_string(belist, "name", &name); + + if (be_unmount(be, name, 0) != 0) { + fprintf(stderr, "bectl %s: failed to unmount %s at %s\n", + cmd, target, path); + return (1); + } + be_prop_list_free(belist); return (0); } Index: sbin/bectl/tests/bectl_test.sh =================================================================== --- sbin/bectl/tests/bectl_test.sh +++ sbin/bectl/tests/bectl_test.sh @@ -466,6 +466,12 @@ atf_check bectl -r ${zpool}/ROOT jail -b default atf_check bectl -r ${zpool}/ROOT unjail default atf_check -s not-exit:0 -x "jls | grep -F \"${root}\"" + # 'unjail' by jail name + atf_check -o empty -s exit:0 bectl -r ${zpool}/ROOT jail -b -o name=bectl_test target + atf_check -o empty -s exit:0 bectl -r ${zpool}/ROOT unjail bectl_test + # 'unjail' by jail id + atf_check -o empty -s exit:0 bectl -r ${zpool}/ROOT jail -b -o jid=999 target + atf_check -o empty -s exit:0 bectl -r ${zpool}/ROOT unjail 999 # 'unjail' by BE name. Force bectl to lookup jail id by the BE name. atf_check -o empty -s exit:0 bectl -r ${zpool}/ROOT jail -b default atf_check -o empty -s exit:0 bectl -r ${zpool}/ROOT jail -b -o name=bectl_test target