forked from illumos/illumos-gate
-
Notifications
You must be signed in to change notification settings - Fork 0
zfs ioctl notes
Bayard G. Bell edited this page Sep 14, 2013
·
1 revision
"snapshot", ZFS_IOC_SNAPSHOT, zfs_ioc_snapshot(), zfs_secpolicy_snapshot, POOL_NAME,
(POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY), smush_out, allow_log
"log_history", ZFS_IOC_LOG_HISTORY, zfs_ioc_log_history(), zfs_secpolicy_log_history, NO_NAME,
(POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY), no_smush, no_log
"space_snaps", ZFS_IOC_SPACE_SNAPS, zfs_ioc_space_snaps(), zfs_secpolicy_read, DATASET_NAME,
POOL_CHECK_SUSPENDED, no_smush, no_log
"send", ZFS_IOC_SEND_NEW, zfs_ioc_send_new(), zfs_secpolicy_send_new, DATASET_NAME,
POOL_CHECK_SUSPENDED, no_smush, no_log
"send_space", ZFS_IOC_SEND_SPACE, zfs_ioc_send_space(), zfs_secpolicy_read, DATASET_NAME,
POOL_CHECK_SUSPENDED, no_smush, no_log
"create", ZFS_IOC_CREATE, zfs_ioc_create(), zfs_secpolicy_create_clone, DATASET_NAME,
(POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY), smush_out, allow_log
"clone", ZFS_IOC_CLONE, zfs_ioc_clone(), zfs_secpolicy_create_clone, DATASET_NAME,
(POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY), smush_out, allow_log
"destroy_snaps", ZFS_IOC_DESTROY_SNAPS, zfs_ioc_destroy_snaps(), zfs_secpolicy_destroy_snaps,
POOL_NAME, (POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY), smush_out, allow_log
"hold", ZFS_IOC_HOLD, zfs_ioc_hold(), zfs_secpolicy_hold, POOL_NAME,
(POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY), smush_out, allow_log
"release", ZFS_IOC_RELEASE, zfs_ioc_release(), zfs_secpolicy_release, POOL_NAME,
(POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY), smush_out, allow_log
"get_holds", ZFS_IOC_GET_HOLDS, zfs_ioc_get_holds(), zfs_secpolicy_read, DATASET_NAME,
POOL_CHECK_SUSPENDED, no_smush, no_log
"rollback", ZFS_IOC_ROLLBACK, zfs_ioc_rollback(), zfs_secpolicy_rollback, DATASET_NAME,
(POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY), no_smush, allow_log
##Legacy
zfs_ioctl_register_legacy, ZFS_IOC_POOL_FREEZE, zfs_ioc_pool_freeze(), zfs_secpolicy_config,
NO_NAME, no_log, POOL_CHECK_READONLY
Notes: freeze currently takes a single pool name and calls into the spa layer to freeze the pool; errors are on spa_open(), spa_freeze() and spa_close() have no return values; errors are passed back by integer return value
zfs_ioctl_register_pool, ZFS_IOC_POOL_CREATE, zfs_ioc_pool_create(), zfs_secpolicy_config,
allow_log, POOL_CHECK_NONE
Notes: pool_create currently takes one mandatory nvlist for config, passed as zc_nvlist_conf, an optional nvlist for properties, passed as zc_nvlist_src; the properties are then seprated out into rootprop and zplprop nvlists; if these properties are determined to be valid, pool is created by call to spa_create(), with rootprops set in a subsequent call if spa_create doesn't return errors; if rootprops cannot be successfully set, pool is destroyed by calling spa_destroy(); errors are passed back via integer return value
zfs_ioctl_register_pool_modify, ZFS_IOC_POOL_SCAN, zfs_ioc_pool_scan()
Notes: pool_scan currently takes a single pool name passed via zc_name, verifies the pool can be opened via spa_open(), returning an error if that fails, otherwise using zc_cookie to determine either to stop an existing scan (if value is POOL_SCAN_NONE, resulting in a call to spa_scan_stop()) or to initiate a new scan by calling spa_scan(), allowing either to error before calling spa_close(); errors are passed back via integer return value
zfs_ioctl_register_pool_modify, ZFS_IOC_POOL_UPGRADE, zfs_ioc_pool_upgrade()
Notes: pool_upgrade currently takes a single pool name passed via zc_name, verifies the pool can be opened via spa_open(), returning an error if that fails, otherwise using zc_cookie to determine the version to which we are trying to upgrade, which is compared to the current version returned by spa_version() to make sure it is greater and generally checked for validity by calling SPA_VERSION_IS_SUPPORTED, returning EINVAL if both conditions are not met; it then calls spa_upgrade(), which does not have a return value, and spa_close(); errors are passed back via integer return value
zfs_ioctl_register_pool_modify, ZFS_IOC_VDEV_ADD, zfs_ioc_vdev_add()
Notes: vdev_add currently takes a single pool name passed via zc_name, verifies the pool can be opened via spa_open(), returning an error if that fails, otherwise using zc_nvlist_conf to pass an nvlist, which is then checked for L2ARC and spares elements identifiable by ZPOOL_CONFIG_L2CACHE and ZPOOL_CONFIG_SPARES, respectively; it refuses to add a vdev to a boot pool if spa_bootfs() is non-zero and the vdev to add is not L2ARC or spare; otherwise it calls spa_vdev_add(), retaining the return value for the caller, then spa_close(); errors are passed back via integer return value
zfs_ioctl_register_pool_modify, ZFS_IOC_VDEV_REMOVE, zfs_ioc_vdev_remove()
Notes: vdev_remove currently takes a single pool name passed via zc_name; it verifies that the pool exists by calling spa_open() and checking the return value; if successful in opening the pool, it calls spa_vdev_remove and passes zc_guid to specify the vdev for removal, retaining the return value to pass back to the caller; it then calls spa_close(); errors are passed back via integer return value
zfs_ioctl_register_pool_modify, ZFS_IOC_VDEV_SET_STATE, zfs_ioc_vdev_set_state()
Notes: vdev_set_state currently takes a single pool name passed via zc_name; it verifies that the pool exists by calling spa_open() and checking the return value; if successful in opening the pool, it uses zc_cookie in a switch statement to determine whether it needs to online, offline, fault, or degrade the device; vdev_online() is called using zc_guid, zc_obj, and a pointer to the function local newstate as parameters, with return value retained to pass back to caller and newstate copied out to zc_cookie; vdev_offline() also uses zc_guid and zc_obj, retaining the return value to pass back to the caller; before vdev_fault() is called, if zc_obj is not set to VDEV_AUX_ERR_EXCEEDED or VDEV_AUX_EXTERNAL, it is set to VDEV_AUX_ERR_EXCEEDED, then zc_guid and zc_obj are used as parameters, with return value retained to pass back to the caller; vdev_degraded() uses the same logic as for faults; spa_close() is called; errors are passed back via integer return value, newstate for online via zc_cookie
zfs_ioctl_register_pool_modify, ZFS_IOC_VDEV_ATTACH, zfs_ioc_vdev_attach()
Note: vdev_attach currently takes a single pool name passed via zc_name; it verifies that the pool exists by calling spa_open() and checking the return value; it also takes zc_nvlist_conf, which it unpacks to get the new config, and it uses zc_cookie to set the replacing parameter and zc_guid as the other parameter in calling out to spa_vdev_attach(), whose return value is retained for the caller; it calls spa_close() before returning; errors are passed back to the caller via integer return value
zfs_ioctl_register_pool_modify, ZFS_IOC_VDEV_DETACH, zfs_ioc_vdev_detach()
zfs_ioctl_register_pool_modify, ZFS_IOC_VDEV_SETPATH, zfs_ioc_vdev_setpath()
zfs_ioctl_register_pool_modify, ZFS_IOC_VDEV_SETFRU, zfs_ioc_vdev_setfru()
zfs_ioctl_register_pool_modify, ZFS_IOC_POOL_SET_PROPS, zfs_ioc_pool_set_props()
zfs_ioctl_register_pool_modify, ZFS_IOC_VDEV_SPLIT, zfs_ioc_vdev_split()
zfs_ioctl_register_pool_modify, ZFS_IOC_POOL_REGUID, zfs_ioc_pool_reguid()
zfs_ioctl_register_pool_meta, ZFS_IOC_POOL_CONFIGS, zfs_ioc_pool_configs(), zfs_secpolicy_none
zfs_ioctl_register_pool_meta, ZFS_IOC_POOL_TRYIMPORT, zfs_ioc_pool_tryimport(), zfs_secpolicy_config
zfs_ioctl_register_pool_meta, ZFS_IOC_INJECT_FAULT, zfs_ioc_inject_fault(), zfs_secpolicy_inject
zfs_ioctl_register_pool_meta, ZFS_IOC_CLEAR_FAULT, zfs_ioc_clear_fault(), zfs_secpolicy_inject
zfs_ioctl_register_pool_meta, ZFS_IOC_INJECT_LIST_NEXT, zfs_ioc_inject_list_next(), zfs_secpolicy_inject
zfs_ioctl_register_pool, ZFS_IOC_POOL_DESTROY, zfs_ioc_pool_destroy(), zfs_secpolicy_config, no_log[1], POOL_CHECK_NONE
zfs_ioctl_register_pool, ZFS_IOC_POOL_EXPORT, zfs_ioc_pool_export(), zfs_secpolicy_config, no_log[1], POOL_CHECK_NONE
zfs_ioctl_register_pool, ZFS_IOC_POOL_STATS, zfs_ioc_pool_stats(), zfs_secpolicy_read, no_log, POOL_CHECK_NONE
zfs_ioctl_register_pool, ZFS_IOC_POOL_GET_PROPS, zfs_ioc_pool_get_props(), zfs_secpolicy_read, no_log, POOL_CHECK_NONE
zfs_ioctl_register_pool, ZFS_IOC_ERROR_LOG, zfs_ioc_error_log(), zfs_secpolicy_inject, no_log, POOL_CHECK_SUSPENDED
zfs_ioctl_register_pool, ZFS_IOC_DSOBJ_TO_DSNAME, zfs_ioc_dsobj_to_dsname(), zfs_secpolicy_diff, no_log, POOL_CHECK_SUSPENDED
zfs_ioctl_register_pool, ZFS_IOC_POOL_GET_HISTORY, zfs_ioc_pool_get_history(), zfs_secpolicy_config, no_log, POOL_CHECK_SUSPENDED
zfs_ioctl_register_pool, ZFS_IOC_POOL_IMPORT, zfs_ioc_pool_import(), zfs_secpolicy_config, allow_log, POOL_CHECK_NONE
zfs_ioctl_register_pool, ZFS_IOC_CLEAR, zfs_ioc_clear(), zfs_secpolicy_config, allow_log, POOL_CHECK_NONE
zfs_ioctl_register_pool, ZFS_IOC_POOL_REOPEN, zfs_ioc_pool_reopen(), zfs_secpolicy_config, allow_log, POOL_CHECK_SUSPENDED
zfs_ioctl_register_dataset_read, ZFS_IOC_SPACE_WRITTEN, zfs_ioc_space_written()
zfs_ioctl_register_dataset_read, ZFS_IOC_OBJSET_RECVD_PROPS, zfs_ioc_objset_recvd_props()
zfs_ioctl_register_dataset_read, ZFS_IOC_NEXT_OBJ, zfs_ioc_next_obj()
zfs_ioctl_register_dataset_read, ZFS_IOC_GET_FSACL, zfs_ioc_get_fsacl()
zfs_ioctl_register_dataset_read, ZFS_IOC_OBJSET_STATS, zfs_ioc_objset_stats()
zfs_ioctl_register_dataset_read, ZFS_IOC_OBJSET_ZPLPROPS, zfs_ioc_objset_zplprops()
zfs_ioctl_register_dataset_read, ZFS_IOC_DATASET_LIST_NEXT, zfs_ioc_dataset_list_next()
zfs_ioctl_register_dataset_read, ZFS_IOC_SNAPSHOT_LIST_NEXT, zfs_ioc_snapshot_list_next()
zfs_ioctl_register_dataset_read, ZFS_IOC_SEND_PROGRESS, zfs_ioc_send_progress()
zfs_ioctl_register_dataset_read_secpolicy, ZFS_IOC_DIFF, zfs_ioc_diff(), zfs_secpolicy_diff
zfs_ioctl_register_dataset_read_secpolicy, ZFS_IOC_OBJ_TO_STATS, zfs_ioc_obj_to_stats(), zfs_secpolicy_diff
zfs_ioctl_register_dataset_read_secpolicy, ZFS_IOC_OBJ_TO_PATH, zfs_ioc_obj_to_path(), zfs_secpolicy_diff
zfs_ioctl_register_dataset_read_secpolicy, ZFS_IOC_USERSPACE_ONE, zfs_ioc_userspace_one(), zfs_secpolicy_userspace_one
zfs_ioctl_register_dataset_read_secpolicy, ZFS_IOC_USERSPACE_MANY, zfs_ioc_userspace_many(), zfs_secpolicy_userspace_many
zfs_ioctl_register_dataset_read_secpolicy, ZFS_IOC_SEND, zfs_ioc_send(), zfs_secpolicy_send
zfs_ioctl_register_dataset_modify, ZFS_IOC_SET_PROP, zfs_ioc_set_prop(), zfs_secpolicy_none
zfs_ioctl_register_dataset_modify, ZFS_IOC_DESTROY, zfs_ioc_destroy(), zfs_secpolicy_destroy
zfs_ioctl_register_dataset_modify, ZFS_IOC_RENAME, zfs_ioc_rename(), zfs_secpolicy_rename
zfs_ioctl_register_dataset_modify, ZFS_IOC_RECV, zfs_ioc_recv(), zfs_secpolicy_recv
zfs_ioctl_register_dataset_modify, ZFS_IOC_PROMOTE, zfs_ioc_promote(), zfs_secpolicy_promote
zfs_ioctl_register_dataset_modify, ZFS_IOC_INHERIT_PROP, zfs_ioc_inherit_prop(), zfs_secpolicy_inherit_prop
zfs_ioctl_register_dataset_modify, ZFS_IOC_SET_FSACL, zfs_ioc_set_fsacl(), zfs_secpolicy_set_fsacl
zfs_ioctl_register_dataset_nolog, ZFS_IOC_SHARE, zfs_ioc_share(), zfs_secpolicy_share, POOL_CHECK_NONE
zfs_ioctl_register_dataset_nolog, ZFS_IOC_SMB_ACL, zfs_ioc_smb_acl(), zfs_secpolicy_smb_acl, POOL_CHECK_NONE
zfs_ioctl_register_dataset_nolog, ZFS_IOC_USERSPACE_UPGRADE, zfs_ioc_userspace_upgrade(), zfs_secpolicy_userspace_upgrade, (POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY)
zfs_ioctl_register_dataset_nolog, ZFS_IOC_TMP_SNAPSHOT, zfs_ioc_tmp_snapshot(), zfs_secpolicy_tmp_snapshot, (POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY)
[1] pool destroy and export don't log the history as part of zfsdev_ioctl, but rather zfs_ioc_pool_export does the logging of those commands.