aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libzfs/libzfs_pool.c
diff options
context:
space:
mode:
authorLOLi <[email protected]>2018-11-06 19:14:56 +0100
committerBrian Behlendorf <[email protected]>2018-11-06 10:14:56 -0800
commitf0f978654581cea4cc042e7f185e1843d727acdb (patch)
tree8c17e7e245f29e153ca31f90114288472c109b1a /lib/libzfs/libzfs_pool.c
parent09b85f2dedfae2f15fed3140ffb3246bef36da97 (diff)
zpool: bogus error for invalid dedupditto value
When provided with an invalid 'dedupditto' value zpool prints a misleading error message: $ sudo zpool set dedupditto=99 pp cannot set property for 'pp': property 'dedupditto'(14) not defined Fix this by printing a meaningful error description for unsupported 'dedupditto' values. Reviewed-by: Olaf Faaland <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: loli10K <[email protected]> Closes #8079
Diffstat (limited to 'lib/libzfs/libzfs_pool.c')
-rw-r--r--lib/libzfs/libzfs_pool.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c
index 128c6efe9..bc320e516 100644
--- a/lib/libzfs/libzfs_pool.c
+++ b/lib/libzfs/libzfs_pool.c
@@ -27,6 +27,7 @@
* Copyright (c) 2018 Datto Inc.
* Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
* Copyright (c) 2017, Intel Corporation.
+ * Copyright (c) 2018, loli10K <[email protected]>
*/
#include <errno.h>
@@ -580,9 +581,9 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char *poolname,
if (intval != 0 &&
(intval < ASHIFT_MIN || intval > ASHIFT_MAX)) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
- "invalid '%s=%d' property: only values "
- "between %" PRId32 " and %" PRId32 " "
- "are allowed.\n"),
+ "property '%s' number %d is invalid, only "
+ "values between %" PRId32 " and "
+ "%" PRId32 " are allowed."),
propname, intval, ASHIFT_MIN, ASHIFT_MAX);
(void) zfs_error(hdl, EZFS_BADPROP, errbuf);
goto error;
@@ -720,6 +721,17 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char *poolname,
goto error;
}
break;
+ case ZPOOL_PROP_DEDUPDITTO:
+ if (intval < ZIO_DEDUPDITTO_MIN && intval != 0) {
+ zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
+ "property '%s' value %d is invalid; only "
+ "values of 0 or >= %" PRId32 " are allowed "
+ "for this property."),
+ propname, intval, ZIO_DEDUPDITTO_MIN);
+ (void) zfs_error(hdl, EZFS_BADPROP, errbuf);
+ goto error;
+ }
+ break;
default:
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,