diff options
Diffstat (limited to 'module/zfs/zfs_ioctl.c')
-rw-r--r-- | module/zfs/zfs_ioctl.c | 66 |
1 files changed, 28 insertions, 38 deletions
diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c index ae82cb45b..9b084632f 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -2089,7 +2089,7 @@ zfs_ioc_objset_zplprops(zfs_cmd_t *zc) return (err); } -static boolean_t +boolean_t dataset_name_hidden(const char *name) { /* @@ -2810,30 +2810,6 @@ zfs_ioc_pool_get_props(zfs_cmd_t *zc) /* * inputs: - * zc_name name of volume - * - * outputs: none - */ -static int -zfs_ioc_create_minor(zfs_cmd_t *zc) -{ - return (zvol_create_minor(zc->zc_name)); -} - -/* - * inputs: - * zc_name name of volume - * - * outputs: none - */ -static int -zfs_ioc_remove_minor(zfs_cmd_t *zc) -{ - return (zvol_remove_minor(zc->zc_name)); -} - -/* - * inputs: * zc_name name of filesystem * zc_nvlist_src{_size} nvlist of delegated permissions * zc_perm_action allow/unallow flag @@ -3174,6 +3150,12 @@ zfs_ioc_create(const char *fsname, nvlist_t *innvl, nvlist_t *outnvl) if (error != 0) (void) dsl_destroy_head(fsname); } + +#ifdef _KERNEL + if (error == 0 && type == DMU_OST_ZVOL) + zvol_create_minors(fsname); +#endif + return (error); } @@ -3216,6 +3198,12 @@ zfs_ioc_clone(const char *fsname, nvlist_t *innvl, nvlist_t *outnvl) if (error != 0) (void) dsl_destroy_head(fsname); } + +#ifdef _KERNEL + if (error == 0) + zvol_create_minors(fsname); +#endif + return (error); } @@ -3276,6 +3264,12 @@ zfs_ioc_snapshot(const char *poolname, nvlist_t *innvl, nvlist_t *outnvl) } error = dsl_dataset_snapshot(snaps, props, outnvl); + +#ifdef _KERNEL + if (error == 0) + zvol_create_minors(poolname); +#endif + return (error); } @@ -3427,10 +3421,10 @@ zfs_ioc_destroy_snaps(const char *poolname, nvlist_t *innvl, nvlist_t *outnvl) (name[poollen] != '/' && name[poollen] != '@')) return (SET_ERROR(EXDEV)); - (void) zvol_remove_minor(name); error = zfs_unmount_snap(name); if (error != 0) return (error); + (void) zvol_remove_minor(name); } return (dsl_destroy_snapshots_nvl(snaps, defer, outnvl)); @@ -3520,7 +3514,6 @@ zfs_ioc_rename(zfs_cmd_t *zc) { boolean_t recursive = zc->zc_cookie & 1; char *at; - int err; zc->zc_value[sizeof (zc->zc_value) - 1] = '\0'; if (dataset_namecheck(zc->zc_value, NULL, NULL) != 0 || @@ -3550,12 +3543,7 @@ zfs_ioc_rename(zfs_cmd_t *zc) return (error); } else { - err = dsl_dir_rename(zc->zc_name, zc->zc_value); - if (!err && zc->zc_objset_type == DMU_OST_ZVOL) { - (void) zvol_remove_minor(zc->zc_name); - (void) zvol_create_minor(zc->zc_value); - } - return (err); + return (dsl_dir_rename(zc->zc_name, zc->zc_value)); } } @@ -4045,6 +4033,12 @@ zfs_ioc_recv(zfs_cmd_t *zc) error = 1; } #endif + +#ifdef _KERNEL + if (error == 0) + zvol_create_minors(tofs); +#endif + /* * On error, restore the original props. */ @@ -5391,12 +5385,8 @@ zfs_ioctl_init(void) POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY); /* - * ZoL functions + * ZoL functions */ - zfs_ioctl_register_legacy(ZFS_IOC_CREATE_MINOR, zfs_ioc_create_minor, - zfs_secpolicy_config, DATASET_NAME, B_FALSE, POOL_CHECK_NONE); - zfs_ioctl_register_legacy(ZFS_IOC_REMOVE_MINOR, zfs_ioc_remove_minor, - zfs_secpolicy_config, DATASET_NAME, B_FALSE, POOL_CHECK_NONE); zfs_ioctl_register_legacy(ZFS_IOC_EVENTS_NEXT, zfs_ioc_events_next, zfs_secpolicy_config, NO_NAME, B_FALSE, POOL_CHECK_NONE); zfs_ioctl_register_legacy(ZFS_IOC_EVENTS_CLEAR, zfs_ioc_events_clear, |