zio_checksum_to_feature() expects a zio_checksum enum not a raw property
intval, so the new checksums weren't being detected when the
ZIO_CHECKSUM_VERIFY flag got in the way.

Given a pool without feature@sha512,

    zfs create -o dedup=sha512 naughty/fivetwelve_noverify_ds

would fail as expected since the raw intval would indeed be equal to
SPA_FEATURE_SHA512.

However,

    zfs create -o dedup=sha512,verify naughty/fivetwelve_verify_ds

would incorrectly succeed because ZIO_CHECKSUM_VERIFY would be in the
way, the raw intval would not be a member of the enum, and
zio_checksum_to_feature() would return SPA_FEATURE_NONE, with the result
that spa_feature_is_enabled() would never be called.

This was first detected with edonr, since in that case verify is
required.

This commit clears the ZIO_CHECKSUM_VERIFY flag before calling
zio_checksum_to_feature() and verifies in zio_checksum_to_feature() that
ZIO_CHECKSUM_VERIFY has been cleared to attempt to prevent the same bug
from occurring again in the future.
You can view, comment on, or merge this pull request online at:

  https://github.com/openzfs/openzfs/pull/51

-- Commit Summary --

  * 6541 dedup=[cksum],verify defeated spa feature check

-- File Changes --

    M usr/src/uts/common/fs/zfs/zfs_ioctl.c (2)
    M usr/src/uts/common/fs/zfs/zio_checksum.c (10)

-- Patch Links --

https://github.com/openzfs/openzfs/pull/51.patch
https://github.com/openzfs/openzfs/pull/51.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/openzfs/openzfs/pull/51
_______________________________________________
developer mailing list
[email protected]
http://lists.open-zfs.org/mailman/listinfo/developer

Reply via email to