]> git.proxmox.com Git - mirror_zfs.git/commit
OpenZFS 6541 - Pool feature-flag check defeated if "verify" is included in the dedup...
authorilovezfs <ilovezfs@icloud.com>
Tue, 26 Jan 2016 07:41:11 +0000 (23:41 -0800)
committerTony Hutter <hutter2@llnl.gov>
Mon, 3 Oct 2016 21:51:21 +0000 (14:51 -0700)
commit4a2e9a17d5b81ae97b2a1b72437def9ed4996aca
tree267f79804fa974db972e4b41ae953e1f2ce28f45
parent3c67d83a8afb391f20bc53d36a0cebea6897b3e2
OpenZFS 6541 - Pool feature-flag check defeated if "verify" is included in the dedup property value

Authored by: ilovezfs <ilovezfs@icloud.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Richard Laager <rlaager@wiktel.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Ported-by: Tony Hutter <hutter2@llnl.gov>
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() using the ZIO_CHECKSUM_MASK and verifies in
zio_checksum_to_feature() that ZIO_CHECKSUM_MASK has been applied by the
caller to attempt to prevent the same bug from occurring again in the
future.

OpenZFS-issue: https://www.illumos.org/issues/6541
OpenZFS-commit: https://github.com/illumos/illumos-gate/commit/971640e6aa954c91b0706543741aa4570299f4d7

Porting notes:
This code was originally from Illumos, but I actually ported it from:
openzfsonosx/zfs@bef06e1
module/zfs/zfs_ioctl.c
module/zfs/zio_checksum.c