summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2016-03-08 17:58:02 +0000
committermav <mav@FreeBSD.org>2016-03-08 17:58:02 +0000
commitf255ec5f1bcbaa2c4bf17805c664f78a3fb3cbf6 (patch)
tree61c5af8aabbf72ecee6bd7fd32cff4703bc780fd
parenta5f2c3291c8a7b2ff4bf232c8b9262acaac371ae (diff)
downloadFreeBSD-src-f255ec5f1bcbaa2c4bf17805c664f78a3fb3cbf6.zip
FreeBSD-src-f255ec5f1bcbaa2c4bf17805c664f78a3fb3cbf6.tar.gz
MFV r296522: 6541 Pool feature-flag check defeated if "verify" is included
in the dedup property value Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: Richard Laager <rlaager@wiktel.com> Approved by: Robert Mustacchi <rm@joyent.com> Author: ilovezfs <ilovezfs@icloud.com> illumos/illumos-gate@971640e6aa954c91b0706543741aa4570299f4d7
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c2
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_checksum.c6
2 files changed, 7 insertions, 1 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
index d68f264..983b4f3 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
@@ -3973,7 +3973,7 @@ zfs_check_settable(const char *dsname, nvpair_t *pair, cred_t *cr)
return (SET_ERROR(EINVAL));
/* check prop value is enabled in features */
- feature = zio_checksum_to_feature(intval);
+ feature = zio_checksum_to_feature(intval & ZIO_CHECKSUM_MASK);
if (feature == SPA_FEATURE_NONE)
break;
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_checksum.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_checksum.c
index 6ba64e0..dac118a 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_checksum.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_checksum.c
@@ -138,10 +138,16 @@ zio_checksum_info_t zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS] = {
#endif
};
+/*
+ * The flag corresponding to the "verify" in dedup=[checksum,]verify
+ * must be cleared first, so callers should use ZIO_CHECKSUM_MASK.
+ */
spa_feature_t
zio_checksum_to_feature(enum zio_checksum cksum)
{
#ifdef illumos
+ VERIFY((cksum & ~ZIO_CHECKSUM_MASK) == 0);
+
switch (cksum) {
case ZIO_CHECKSUM_SHA512:
return (SPA_FEATURE_SHA512);
OpenPOWER on IntegriCloud