summaryrefslogtreecommitdiffstats
path: root/module/zfs
diff options
context:
space:
mode:
authorLOLi <[email protected]>2018-08-03 23:56:25 +0200
committerTony Hutter <[email protected]>2018-07-06 02:46:51 -0700
commitcaafa436eb335349f75fb6a72c06eb21e87ffb9e (patch)
tree583c15d12f4d2c62adbeab1bd18323400e676ad2 /module/zfs
parentfe8de1c8a653fed150979f7d37be8f189327b7ef (diff)
Allow inherited properties in zfs_check_settable()
This change modifies how 'checksum' and 'dedup' properties are verified in zfs_check_settable() handling the case where they are explicitly inherited in the dataset hierarchy when receiving a recursive send stream. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Tom Caputi <[email protected]> Signed-off-by: loli10K <[email protected]> Closes #7755 Closes #7576 Closes #7757
Diffstat (limited to 'module/zfs')
-rw-r--r--module/zfs/zfs_ioctl.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c
index 6516f6469..b8783e54a 100644
--- a/module/zfs/zfs_ioctl.c
+++ b/module/zfs/zfs_ioctl.c
@@ -3967,7 +3967,6 @@ zfs_check_settable(const char *dsname, nvpair_t *pair, cred_t *cr)
{
spa_feature_t feature;
spa_t *spa;
- uint64_t intval;
int err;
/* dedup feature version checks */
@@ -3975,22 +3974,23 @@ zfs_check_settable(const char *dsname, nvpair_t *pair, cred_t *cr)
zfs_earlier_version(dsname, SPA_VERSION_DEDUP))
return (SET_ERROR(ENOTSUP));
- if (nvpair_value_uint64(pair, &intval) != 0)
- return (SET_ERROR(EINVAL));
-
- /* check prop value is enabled in features */
- feature = zio_checksum_to_feature(intval & ZIO_CHECKSUM_MASK);
- if (feature == SPA_FEATURE_NONE)
- break;
+ if (nvpair_type(pair) == DATA_TYPE_UINT64 &&
+ nvpair_value_uint64(pair, &intval) == 0) {
+ /* check prop value is enabled in features */
+ feature = zio_checksum_to_feature(
+ intval & ZIO_CHECKSUM_MASK);
+ if (feature == SPA_FEATURE_NONE)
+ break;
- if ((err = spa_open(dsname, &spa, FTAG)) != 0)
- return (err);
+ if ((err = spa_open(dsname, &spa, FTAG)) != 0)
+ return (err);
- if (!spa_feature_is_enabled(spa, feature)) {
+ if (!spa_feature_is_enabled(spa, feature)) {
+ spa_close(spa, FTAG);
+ return (SET_ERROR(ENOTSUP));
+ }
spa_close(spa, FTAG);
- return (SET_ERROR(ENOTSUP));
}
- spa_close(spa, FTAG);
break;
}