Skip to content

Commit

Permalink
Make spa.c assertions catch unsupported pre-feature flag pool versions
Browse files Browse the repository at this point in the history
A couple of assertions in spa.c were designed to prevent the use of
invalid pool versions. They were written under the assumption
that all valid pools are less than SPA_VERSION. Since feature flags
jumped from 28 to 5000, any numbers in the range 28 to 5000
non-inclusive will fail to trigger them.  We switch to the new
SPA_VERSION_IS_SUPPORTED macro to correct this.

Signed-off-by: Richard Yao <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs#1282
  • Loading branch information
ryao authored and unya committed Dec 13, 2013
1 parent b7ba597 commit b7b5851
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions module/zfs/spa.c
Original file line number Diff line number Diff line change
Expand Up @@ -5788,7 +5788,7 @@ spa_sync_version(void *arg1, void *arg2, dmu_tx_t *tx)
*/
ASSERT(tx->tx_txg != TXG_INITIAL);

ASSERT(version <= SPA_VERSION);
ASSERT(SPA_VERSION_IS_SUPPORTED(version));
ASSERT(version >= spa_version(spa));

spa->spa_uberblock.ub_version = version;
Expand Down Expand Up @@ -6312,7 +6312,7 @@ spa_upgrade(spa_t *spa, uint64_t version)
* future version would result in an unopenable pool, this shouldn't be
* possible.
*/
ASSERT(spa->spa_uberblock.ub_version <= SPA_VERSION);
ASSERT(SPA_VERSION_IS_SUPPORTED(spa->spa_uberblock.ub_version));
ASSERT(version >= spa->spa_uberblock.ub_version);

spa->spa_uberblock.ub_version = version;
Expand Down

0 comments on commit b7b5851

Please sign in to comment.