diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libzfs/libzfs.abi | 3 | ||||
-rw-r--r-- | lib/libzfs/libzfs_pool.c | 15 | ||||
-rw-r--r-- | lib/libzfs_core/libzfs_core.abi | 3 |
3 files changed, 14 insertions, 7 deletions
diff --git a/lib/libzfs/libzfs.abi b/lib/libzfs/libzfs.abi index 732863dcf..57b096ca6 100644 --- a/lib/libzfs/libzfs.abi +++ b/lib/libzfs/libzfs.abi @@ -5741,7 +5741,8 @@ <enumerator name='POOL_INITIALIZE_START' value='0'/> <enumerator name='POOL_INITIALIZE_CANCEL' value='1'/> <enumerator name='POOL_INITIALIZE_SUSPEND' value='2'/> - <enumerator name='POOL_INITIALIZE_FUNCS' value='3'/> + <enumerator name='POOL_INITIALIZE_UNINIT' value='3'/> + <enumerator name='POOL_INITIALIZE_FUNCS' value='4'/> </enum-decl> <typedef-decl name='pool_initialize_func_t' type-id='5c246ad4' id='7063e1ab'/> <enum-decl name='pool_trim_func' id='54ed608a'> diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c index 4fb71b4e0..a71cb2473 100644 --- a/lib/libzfs/libzfs_pool.c +++ b/lib/libzfs/libzfs_pool.c @@ -2387,8 +2387,8 @@ xlate_init_err(int err) } /* - * Begin, suspend, or cancel the initialization (initializing of all free - * blocks) for the given vdevs in the given pool. + * Begin, suspend, cancel, or uninit (clear) the initialization (initializing + * of all free blocks) for the given vdevs in the given pool. */ static int zpool_initialize_impl(zpool_handle_t *zhp, pool_initialize_func_t cmd_type, @@ -2414,11 +2414,16 @@ zpool_initialize_impl(zpool_handle_t *zhp, pool_initialize_func_t cmd_type, vdev_guids, &errlist); if (err != 0) { - if (errlist != NULL) { - vd_errlist = fnvlist_lookup_nvlist(errlist, - ZPOOL_INITIALIZE_VDEVS); + if (errlist != NULL && nvlist_lookup_nvlist(errlist, + ZPOOL_INITIALIZE_VDEVS, &vd_errlist) == 0) { goto list_errors; } + + if (err == EINVAL && cmd_type == POOL_INITIALIZE_UNINIT) { + zfs_error_aux(zhp->zpool_hdl, dgettext(TEXT_DOMAIN, + "uninitialize is not supported by kernel")); + } + (void) zpool_standard_error(zhp->zpool_hdl, err, dgettext(TEXT_DOMAIN, "operation failed")); goto out; diff --git a/lib/libzfs_core/libzfs_core.abi b/lib/libzfs_core/libzfs_core.abi index ec94a4650..33d794e3f 100644 --- a/lib/libzfs_core/libzfs_core.abi +++ b/lib/libzfs_core/libzfs_core.abi @@ -1249,7 +1249,8 @@ <enumerator name='POOL_INITIALIZE_START' value='0'/> <enumerator name='POOL_INITIALIZE_CANCEL' value='1'/> <enumerator name='POOL_INITIALIZE_SUSPEND' value='2'/> - <enumerator name='POOL_INITIALIZE_FUNCS' value='3'/> + <enumerator name='POOL_INITIALIZE_UNINIT' value='3'/> + <enumerator name='POOL_INITIALIZE_FUNCS' value='4'/> </enum-decl> <typedef-decl name='pool_initialize_func_t' type-id='5c246ad4' id='7063e1ab'/> <enum-decl name='pool_trim_func' id='54ed608a'> |