Skip to content

Commit

Permalink
OpenZFS 6585 - sha512, skein, and edonr have an unenforced dependency…
Browse files Browse the repository at this point in the history
… on extensible dataset

Authored by: ilovezfs <[email protected]>
Reviewed by: Matthew Ahrens <[email protected]>
Reviewed by: Richard Laager <[email protected]>
Approved by: Robert Mustacchi <[email protected]>
Ported by: Tony Hutter <[email protected]>

In any pool without the extensible dataset feature flag already enabled,
creating a dataset with dedup set to use one of the new checksums would
result in the following panic as soon as any data was added:

panic[cpu0]/thread=ffffff0006761c40: feature_get_refcount(spa, feature,
&refcount) != 48 (0x30 != 0x30), file: ../../common/fs/zfs/zfeature.c
line 390

Inpsection showed that feature->fi_feature was 7, which is the value of
SPA_FEATURE_EXTENSIBLE_DATASET in the spa_feature enum.  This commit
adds extensible dataset as a dependency for the sha512, edonr, and skein
feature flags, which prevents the panic.

OpenZFS-issue: https://www.illumos.org/issues/6585
OpenZFS-commit: illumos/illumos-gate@892586e
Porting Notes:
This code was originally from Illumos, but I actually ported it from:
openzfsonosx/zfs@b62a652
  • Loading branch information
ilovezfs authored and tonyhutter committed Oct 3, 2016
1 parent 4a2e9a1 commit 125a406
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
6 changes: 3 additions & 3 deletions man/man5/zpool-features.5
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ improving performance by avoiding the use of spill blocks.
l l .
GUID org.illumos:sha512
READ\-ONLY COMPATIBLE no
DEPENDENCIES none
DEPENDENCIES extensible_dataset
.TE

This feature enables the use of the SHA-512/256 truncated hash algorithm
Expand Down Expand Up @@ -497,7 +497,7 @@ the updated GRUB stage2 module is installed).
l l .
GUID org.illumos:skein
READ\-ONLY COMPATIBLE no
DEPENDENCIES none
DEPENDENCIES extensible_dataset
.TE

This feature enables the use of the Skein hash algorithm for checksum
Expand Down Expand Up @@ -533,7 +533,7 @@ error.
l l .
GUID org.illumos:edonr
READ\-ONLY COMPATIBLE no
DEPENDENCIES none
DEPENDENCIES extensible_dataset
.TE

This feature enables the use of the Edon-R hash algorithm for checksum,
Expand Down
26 changes: 23 additions & 3 deletions module/zfs/zfeature_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,16 +253,36 @@ zpool_feature_init(void)
"Variable on-disk size of dnodes.",
ZFEATURE_FLAG_PER_DATASET, large_dnode_deps);
}

{
static const spa_feature_t sha512_deps[] = {
SPA_FEATURE_EXTENSIBLE_DATASET,
SPA_FEATURE_NONE
};
zfeature_register(SPA_FEATURE_SHA512,
"org.illumos:sha512", "sha512",
"SHA-512/256 hash algorithm.",
ZFEATURE_FLAG_PER_DATASET, NULL);
ZFEATURE_FLAG_PER_DATASET, sha512_deps);
}
{
static const spa_feature_t skein_deps[] = {
SPA_FEATURE_EXTENSIBLE_DATASET,
SPA_FEATURE_NONE
};
zfeature_register(SPA_FEATURE_SKEIN,
"org.illumos:skein", "skein",
"Skein hash algorithm.",
ZFEATURE_FLAG_PER_DATASET, NULL);
ZFEATURE_FLAG_PER_DATASET, skein_deps);
}

{
static const spa_feature_t edonr_deps[] = {
SPA_FEATURE_EXTENSIBLE_DATASET,
SPA_FEATURE_NONE
};
zfeature_register(SPA_FEATURE_EDONR,
"org.illumos:edonr", "edonr",
"Edon-R hash algorithm.",
ZFEATURE_FLAG_PER_DATASET, NULL);
ZFEATURE_FLAG_PER_DATASET, edonr_deps);
}
}

0 comments on commit 125a406

Please sign in to comment.