a010b40938
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
96 lines
3.9 KiB
Diff
96 lines
3.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: LOLi <loli10K@users.noreply.github.com>
|
|
Date: Fri, 3 Aug 2018 23:56:25 +0200
|
|
Subject: [PATCH] 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 <behlendorf1@llnl.gov>
|
|
Reviewed-by: Tom Caputi <tcaputi@datto.com>
|
|
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
|
|
Closes #7755
|
|
Closes #7576
|
|
Closes #7757
|
|
|
|
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
|
---
|
|
module/zfs/zfs_ioctl.c | 26 +++++++++++-----------
|
|
.../zfs_receive/receive-o-x_props_override.ksh | 6 +++--
|
|
2 files changed, 17 insertions(+), 15 deletions(-)
|
|
|
|
diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c
|
|
index 6516f646..b8783e54 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;
|
|
}
|
|
|
|
diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/receive-o-x_props_override.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/receive-o-x_props_override.ksh
|
|
index 4e3a5393..583d8eb1 100755
|
|
--- a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/receive-o-x_props_override.ksh
|
|
+++ b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/receive-o-x_props_override.ksh
|
|
@@ -221,15 +221,17 @@ log_must eval "zfs set '$userprop:snap'='$userval' $origsub@snap3"
|
|
log_must eval "zfs send -R -I $orig@snap1 $orig@snap3 > $streamfile_incr"
|
|
# Sets various combination of override and exclude options
|
|
log_must eval "zfs recv -F -o atime=off -o '$userprop:dest2'='$userval' "\
|
|
- "-o quota=123456789 -x compression -x '$userprop:orig' " \
|
|
- "-x '$userprop:snap3' $dest < $streamfile_incr"
|
|
+ "-o quota=123456789 -o checksum=sha512 -x compression "\
|
|
+ "-x '$userprop:orig' -x '$userprop:snap3' $dest < $streamfile_incr"
|
|
# Verify we can correctly override and exclude properties
|
|
log_must eval "check_prop_source $dest copies 2 received"
|
|
log_must eval "check_prop_source $dest atime off local"
|
|
log_must eval "check_prop_source $dest '$userprop:dest2' '$userval' local"
|
|
log_must eval "check_prop_source $dest quota 123456789 local"
|
|
+log_must eval "check_prop_source $dest checksum sha512 local"
|
|
log_must eval "check_prop_inherit $destsub copies $dest"
|
|
log_must eval "check_prop_inherit $destsub atime $dest"
|
|
+log_must eval "check_prop_inherit $destsub checksum $dest"
|
|
log_must eval "check_prop_inherit $destsub '$userprop:dest2' $dest"
|
|
log_must eval "check_prop_source $destsub quota 0 default"
|
|
log_must eval "check_prop_source $destsub compression off default"
|