Lines Matching refs:zhp

253 	zfs_handle_t	*zhp;  in _be_mount()  local
284 if ((zhp = zfs_open(g_zfs, bt.obe_root_ds, ZFS_TYPE_FILESYSTEM)) == in _be_mount()
293 if (zfs_is_mounted(zhp, &mp)) { in _be_mount()
294 ZFS_CLOSE(zhp); in _be_mount()
305 if ((ret = fix_mountpoint(zhp)) != BE_SUCCESS) { in _be_mount()
308 ZFS_CLOSE(zhp); in _be_mount()
321 ZFS_CLOSE(zhp); in _be_mount()
335 if ((ret = be_mount_root(zhp, tmp_altroot)) != BE_SUCCESS) { in _be_mount()
340 ZFS_CLOSE(zhp); in _be_mount()
345 if ((ret = be_mount_zone_root(zhp, &md)) != BE_SUCCESS) { in _be_mount()
349 ZFS_CLOSE(zhp); in _be_mount()
355 if ((err = zfs_iter_filesystems(zhp, be_mount_callback, in _be_mount()
361 ZFS_CLOSE(zhp); in _be_mount()
384 if (be_mount_zones(zhp, &md) != BE_SUCCESS) { in _be_mount()
389 ZFS_CLOSE(zhp); in _be_mount()
422 zfs_handle_t *zhp; in _be_unmount() local
455 if ((zhp = zfs_open(g_zfs, bt.obe_root_ds, ZFS_TYPE_FILESYSTEM)) == in _be_unmount()
465 if (!zfs_is_mounted(zhp, &mp)) { in _be_unmount()
474 if ((ret = fix_mountpoint(zhp)) != BE_SUCCESS) { in _be_unmount()
477 ZFS_CLOSE(zhp); in _be_unmount()
481 ZFS_CLOSE(zhp); in _be_unmount()
490 if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, mountpoint, in _be_unmount()
494 ZFS_CLOSE(zhp); in _be_unmount()
506 ZFS_CLOSE(zhp); in _be_unmount()
517 ZFS_CLOSE(zhp); in _be_unmount()
528 ZFS_CLOSE(zhp); in _be_unmount()
533 if ((zret = zfs_iter_filesystems(zhp, be_unmount_callback, in _be_unmount()
537 ZFS_CLOSE(zhp); in _be_unmount()
543 if ((ret = be_unmount_root(zhp, &ud)) != BE_SUCCESS) { in _be_unmount()
544 ZFS_CLOSE(zhp); in _be_unmount()
548 if ((ret = be_unmount_zone_root(zhp, &ud)) != BE_SUCCESS) { in _be_unmount()
549 ZFS_CLOSE(zhp); in _be_unmount()
554 ZFS_CLOSE(zhp); in _be_unmount()
572 be_mount_zone_root(zfs_handle_t *zhp, be_mount_data_t *md) in be_mount_zone_root() argument
579 if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, mountpoint, in be_mount_zone_root()
582 "get mountpoint property for %s: %s\n"), zfs_get_name(zhp), in be_mount_zone_root()
621 if (mount(zfs_get_name(zhp), md->altroot, MS_OVERLAY, MNTTYPE_ZFS, in be_mount_zone_root()
626 zfs_get_name(zhp), md->altroot); in be_mount_zone_root()
646 be_unmount_zone_root(zfs_handle_t *zhp, be_unmount_data_t *ud) in be_unmount_zone_root() argument
651 if (zfs_unmount(zhp, NULL, ud->force ? MS_FORCE : 0) != 0) { in be_unmount_zone_root()
653 "unmount zone root dataset %s: %s\n"), zfs_get_name(zhp), in be_unmount_zone_root()
659 if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, mountpoint, in be_unmount_zone_root()
663 zfs_get_name(zhp), libzfs_error_description(g_zfs)); in be_unmount_zone_root()
669 if (zfs_prop_set(zhp, zfs_prop_to_name(ZFS_PROP_MOUNTPOINT), in be_unmount_zone_root()
673 "%s to 'legacy': %s\n"), zfs_get_name(zhp), in be_unmount_zone_root()
711 zfs_handle_t *zhp = NULL; in be_get_legacy_fs() local
721 if ((zhp = zfs_open(g_zfs, be_root_ds, ZFS_TYPE_FILESYSTEM)) in be_get_legacy_fs()
731 if (!zfs_is_mounted(zhp, &fld->altroot)) { in be_get_legacy_fs()
758 ZFS_CLOSE(zhp); in be_get_legacy_fs()
761 if ((zhp = zfs_open(g_zfs, zoneroot_ds, in be_get_legacy_fs()
771 if (!zfs_is_mounted(zhp, &zone_md.altroot)) { in be_get_legacy_fs()
784 if ((ret = be_mount_zone_root(zhp, &zone_md)) in be_get_legacy_fs()
804 if (get_mountpoint_from_vfstab(fld->altroot, zfs_get_name(zhp), in be_get_legacy_fs()
807 if (add_to_fs_list(fld, zfs_get_name(zhp)) in be_get_legacy_fs()
811 zfs_get_name(zhp)); in be_get_legacy_fs()
819 if ((ret = zfs_iter_filesystems(zhp, be_get_legacy_fs_callback, in be_get_legacy_fs()
823 zfs_get_name(zhp)); in be_get_legacy_fs()
833 if ((err = be_unmount_zone_root(zhp, &zone_ud)) != BE_SUCCESS) { in be_get_legacy_fs()
852 ZFS_CLOSE(zhp); in be_get_legacy_fs()
993 zfs_handle_t *zhp, in be_mount_pool() argument
1006 if (!zfs_is_mounted(zhp, NULL)) { in be_mount_pool()
1007 if (zfs_mount(zhp, NULL, 0) != 0) { in be_mount_pool()
1008 if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, mountpoint, in be_mount_pool()
1012 zfs_get_name(zhp), in be_mount_pool()
1033 if (zfs_prop_set(zhp, in be_mount_pool()
1038 "%s: %s\n"), zfs_get_name(zhp), in be_mount_pool()
1048 if (zfs_mount(zhp, NULL, 0) != 0) { in be_mount_pool()
1051 zfs_get_name(zhp), *tmp_mntpnt, in be_mount_pool()
1054 if (zfs_prop_set(zhp, in be_mount_pool()
1060 zfs_get_name(zhp), *tmp_mntpnt, in be_mount_pool()
1097 zfs_handle_t *zhp, in be_unmount_pool() argument
1101 if (zfs_unmount(zhp, NULL, 0) != 0) { in be_unmount_pool()
1103 "unmount pool (%s): %s\n"), zfs_get_name(zhp), in be_unmount_pool()
1112 if (zfs_prop_set(zhp, in be_unmount_pool()
1117 "%s: %s\n"), zfs_get_name(zhp), orig_mntpnt, in be_unmount_pool()
1145 be_mount_callback(zfs_handle_t *zhp, void *data) in be_mount_callback() argument
1148 const char *fs_name = zfs_get_name(zhp); in be_mount_callback()
1156 if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, zhp_mountpoint, in be_mount_callback()
1162 ZFS_CLOSE(zhp); in be_mount_callback()
1171 if (zfs_prop_set(zhp, zfs_prop_to_name(ZFS_PROP_CANMOUNT), "noauto")) { in be_mount_callback()
1174 ZFS_CLOSE(zhp); in be_mount_callback()
1229 if (zfs_prop_set(zhp, in be_mount_callback()
1235 ZFS_CLOSE(zhp); in be_mount_callback()
1247 if (zfs_mount(zhp, NULL, 0) != 0) { in be_mount_callback()
1257 (void) zfs_prop_set(zhp, in be_mount_callback()
1262 ZFS_CLOSE(zhp); in be_mount_callback()
1268 if ((ret = zfs_iter_filesystems(zhp, be_mount_callback, in be_mount_callback()
1270 ZFS_CLOSE(zhp); in be_mount_callback()
1275 ZFS_CLOSE(zhp); in be_mount_callback()
1294 be_unmount_callback(zfs_handle_t *zhp, void *data) in be_unmount_callback() argument
1298 const char *fs_name = zfs_get_name(zhp); in be_unmount_callback()
1305 if (zfs_iter_filesystems(zhp, be_unmount_callback, ud)) { in be_unmount_callback()
1311 if (!zfs_is_mounted(zhp, NULL)) in be_unmount_callback()
1315 if (zfs_unmount(zhp, NULL, ud->force ? MS_FORCE : 0) != 0) { in be_unmount_callback()
1324 if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, mountpoint, in be_unmount_callback()
1368 if (zfs_prop_set(zhp, in be_unmount_callback()
1400 if (zfs_prop_set(zhp, zfs_prop_to_name(ZFS_PROP_CANMOUNT), "noauto")) { in be_unmount_callback()
1407 ZFS_CLOSE(zhp); in be_unmount_callback()
1428 be_get_legacy_fs_callback(zfs_handle_t *zhp, void *data) in be_get_legacy_fs_callback() argument
1431 const char *fs_name = zfs_get_name(zhp); in be_get_legacy_fs_callback()
1437 if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, zhp_mountpoint, in be_get_legacy_fs_callback()
1443 ZFS_CLOSE(zhp); in be_get_legacy_fs_callback()
1463 if (add_to_fs_list(fld, zfs_get_name(zhp)) != BE_SUCCESS) { in be_get_legacy_fs_callback()
1466 ZFS_CLOSE(zhp); in be_get_legacy_fs_callback()
1473 if ((ret = zfs_iter_filesystems(zhp, be_get_legacy_fs_callback, in be_get_legacy_fs_callback()
1475 ZFS_CLOSE(zhp); in be_get_legacy_fs_callback()
1478 ZFS_CLOSE(zhp); in be_get_legacy_fs_callback()
1538 zfs_handle_t *zhp = NULL; in zpool_shared_fs_callback() local
1545 if ((zhp = zfs_open(g_zfs, zpool, ZFS_TYPE_FILESYSTEM)) == NULL) { in zpool_shared_fs_callback()
1555 (void) loopback_mount_shared_fs(zhp, md); in zpool_shared_fs_callback()
1558 (void) zfs_iter_filesystems(zhp, iter_shared_fs_callback, md); in zpool_shared_fs_callback()
1560 ZFS_CLOSE(zhp); in zpool_shared_fs_callback()
1590 iter_shared_fs_callback(zfs_handle_t *zhp, void *data) in iter_shared_fs_callback() argument
1593 const char *name = zfs_get_name(zhp); in iter_shared_fs_callback()
1612 ZFS_CLOSE(zhp); in iter_shared_fs_callback()
1619 ZFS_CLOSE(zhp); in iter_shared_fs_callback()
1624 (void) loopback_mount_shared_fs(zhp, md); in iter_shared_fs_callback()
1627 (void) zfs_iter_filesystems(zhp, iter_shared_fs_callback, md); in iter_shared_fs_callback()
1628 ZFS_CLOSE(zhp); in iter_shared_fs_callback()
1652 loopback_mount_shared_fs(zfs_handle_t *zhp, be_mount_data_t *md) in loopback_mount_shared_fs() argument
1665 if (zfs_is_mounted(zhp, &mp) && (getzoneid() != GLOBAL_ZONEID || in loopback_mount_shared_fs()
1666 !zfs_prop_get_int(zhp, ZFS_PROP_ZONED))) { in loopback_mount_shared_fs()
1672 if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, in loopback_mount_shared_fs()
2035 fix_mountpoint_callback(zfs_handle_t *zhp, void *data) in fix_mountpoint_callback() argument
2045 if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, mountpoint, in fix_mountpoint_callback()
2050 zfs_get_name(zhp)); in fix_mountpoint_callback()
2051 ZFS_CLOSE(zhp); in fix_mountpoint_callback()
2077 if (zfs_prop_set(zhp, in fix_mountpoint_callback()
2082 "%s: %s\n"), zfs_get_name(zhp), in fix_mountpoint_callback()
2086 ZFS_CLOSE(zhp); in fix_mountpoint_callback()
2093 if ((ret = zfs_iter_filesystems(zhp, fix_mountpoint_callback, in fix_mountpoint_callback()
2095 ZFS_CLOSE(zhp); in fix_mountpoint_callback()
2100 ZFS_CLOSE(zhp); in fix_mountpoint_callback()
2119 be_mount_root(zfs_handle_t *zhp, char *altroot) in be_mount_root() argument
2124 if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, mountpoint, in be_mount_root()
2127 "get mountpoint property for %s: %s\n"), zfs_get_name(zhp), in be_mount_root()
2137 if (zfs_prop_set(zhp, zfs_prop_to_name(ZFS_PROP_CANMOUNT), "noauto") in be_mount_root()
2141 zfs_get_name(zhp), libzfs_error_description(g_zfs)); in be_mount_root()
2146 if (zfs_prop_set(zhp, zfs_prop_to_name(ZFS_PROP_MOUNTPOINT), altroot) in be_mount_root()
2150 zfs_get_name(zhp), altroot, in be_mount_root()
2156 if (zfs_mount(zhp, NULL, 0) != 0) { in be_mount_root()
2158 "mount dataset %s at %s: %s\n"), zfs_get_name(zhp), in be_mount_root()
2164 (void) zfs_prop_set(zhp, zfs_prop_to_name(ZFS_PROP_MOUNTPOINT), in be_mount_root()
2193 be_unmount_root(zfs_handle_t *zhp, be_unmount_data_t *ud) in be_unmount_root() argument
2199 if (get_mountpoint_from_vfstab(ud->altroot, zfs_get_name(zhp), in be_unmount_root()
2206 if (zfs_unmount(zhp, NULL, ud->force ? MS_FORCE : 0) != 0) { in be_unmount_root()
2208 "unmount BE root dataset %s: %s\n"), zfs_get_name(zhp), in be_unmount_root()
2214 if (zfs_prop_set(zhp, zfs_prop_to_name(ZFS_PROP_CANMOUNT), "noauto") in be_unmount_root()
2218 zfs_get_name(zhp), libzfs_error_description(g_zfs)); in be_unmount_root()
2226 if (zfs_prop_set(zhp, zfs_prop_to_name(ZFS_PROP_MOUNTPOINT), in be_unmount_root()
2229 "set mountpoint of %s to %s\n"), zfs_get_name(zhp), in be_unmount_root()
2255 fix_mountpoint(zfs_handle_t *zhp) in fix_mountpoint() argument
2266 if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, mountpoint, in fix_mountpoint()
2269 "mountpoint property of (%s): %s\n"), zfs_get_name(zhp), in fix_mountpoint()
2286 if (zfs_iter_filesystems(zhp, fix_mountpoint_callback, mountpoint) in fix_mountpoint()
2306 if ((ret = be_mount_root(zhp, altroot)) != BE_SUCCESS) { in fix_mountpoint()
2312 if ((ret = be_unmount_root(zhp, &ud)) != BE_SUCCESS) { in fix_mountpoint()
2701 be_get_ds_from_dir_callback(zfs_handle_t *zhp, void *data) in be_get_ds_from_dir_callback() argument
2707 if (zfs_get_type(zhp) != ZFS_TYPE_FILESYSTEM) { in be_get_ds_from_dir_callback()
2708 ZFS_CLOSE(zhp); in be_get_ds_from_dir_callback()
2712 if (zfs_is_mounted(zhp, &mp) && mp != NULL && in be_get_ds_from_dir_callback()
2714 if ((dd->ds = strdup(zfs_get_name(zhp))) == NULL) { in be_get_ds_from_dir_callback()
2717 ZFS_CLOSE(zhp); in be_get_ds_from_dir_callback()
2720 ZFS_CLOSE(zhp); in be_get_ds_from_dir_callback()
2724 zret = zfs_iter_filesystems(zhp, be_get_ds_from_dir_callback, dd); in be_get_ds_from_dir_callback()
2726 ZFS_CLOSE(zhp); in be_get_ds_from_dir_callback()