Bug 190462 - request: don't active feature flags when upgrading zfs pool
Summary: request: don't active feature flags when upgrading zfs pool
Status: Closed Works As Intended
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 10.0-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: Graham Perrin
URL:
Keywords: feature
Depends on:
Blocks:
 
Reported: 2014-06-01 23:55 UTC by curlymoo1
Modified: 2023-10-16 08:58 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description curlymoo1 2014-06-01 23:55:50 UTC
The new OpenZFS initiative introduced "feature flags". A new pool version v5000 was introduced to mark this new features. Feature flags are mostly independent features that can be enabled or disabled on a zfs pool or filesystem. However, the pool will only be importable by zfs versions that also support all feature flags.

The main problem is, that you can't decide which feature flags will be activated and which won't. 

An example. I've created a test pool with v28. When i upgrade this pool all feature flags are automatically enabled.

What i'm requesting is the following. I create a pool with v28. When i upgrade the pool to v5000, i just want to have an dummy v5000 pool. This practically means i have gained nothing except the pool version change. No feature flags will be enabled. This pool should be compatible with all zfs versions supporting feature flags.

If we look at this page http://open-zfs.org/wiki/Features we see that zfsonlinux and ZFS-OSX don't yet support the multi_vdev_crash_dump feature flag. So once i upgrade a zfs pool to v5000 in FreeBSD, i won't be able to import it on zfsonlinux and ZFS-OSX.

What i want to be able to do, is activate independent feature flags. In my case, i really want to use lz4_compress. This feature is supported in all zfs implementations. So when i upgrade, nothing is enabled, and afterwards i can enable just those feature i want to use to maintain the largest cross-compatibility possible.

Environment:
FreeBSD server.workgroup 10.0-STABLE FreeBSD 10.0-STABLE #0: Sun Apr 20 21:20:08 UTC 2014     jason@zfsguru:/usr/obj/tmpfs/2-source/sys/NEWCONS-OFED-POLLING-ALTQ  amd64

How-To-Repeat:
Create a pool with v28.
Upgrade that pool to v5000.

Fix:
Not yet possible.

Patch attached with submission follows:


[root@server /home/ssh]# zpool status test
  pool: test
 state: ONLINE
status: The pool is formatted using a legacy on-disk format.  The pool can
        still be used, but some features are unavailable.
action: Upgrade the pool using 'zpool upgrade'.  Once this is done, the
        pool will no longer be accessible on software that does not support feature
        flags.
  scan: none requested
config:

        NAME           STATE     READ WRITE CKSUM
        test           ONLINE       0     0     0
          mirror-0     ONLINE       0     0     0
            gpt/test1  ONLINE       0     0     0
            gpt/test2  ONLINE       0     0     0

errors: No known data errors
[root@server /home/ssh]# zpool upgrade test
This system supports ZFS pool feature flags.

Successfully upgraded 'test' from version 28 to feature flags.
Enabled the following features on 'test':
  async_destroy
  empty_bpobj
  lz4_compress
  multi_vdev_crash_dump
  spacemap_histogram
  enabled_txg
  hole_birth
  extensible_dataset
  bookmarks

[root@server /home/ssh]# zpool status test
  pool: test
 state: ONLINE
  scan: none requested
config:

        NAME           STATE     READ WRITE CKSUM
        test           ONLINE       0     0     0
          mirror-0     ONLINE       0     0     0
            gpt/test1  ONLINE       0     0     0
            gpt/test2  ONLINE       0     0     0

errors: No known data errors
Comment 1 Fabian Keil 2015-10-30 12:40:38 UTC
Individual features can be enabled with zpool set. Example:

fk@r500 ~ $zpool get all test
NAME  PROPERTY                       VALUE                          SOURCE
[...]
test  feature@async_destroy          disabled                       local
test  feature@empty_bpobj            disabled                       local
test  feature@lz4_compress           disabled                       local
test  feature@multi_vdev_crash_dump  disabled                       local
test  feature@spacemap_histogram     disabled                       local
test  feature@enabled_txg            disabled                       local
test  feature@hole_birth             disabled                       local
test  feature@extensible_dataset     disabled                       local
test  feature@embedded_data          disabled                       local
test  feature@bookmarks              disabled                       local
test  feature@filesystem_limits      disabled                       local
test  feature@large_blocks           disabled                       local
fk@r500 ~ $sudo zpool set feature@empty_bpobj=enabled test
fk@r500 ~ $sudo zpool set feature@embedded_data=enabled test
fk@r500 ~ $zpool get all test
NAME  PROPERTY                       VALUE                          SOURCE
[...]
test  feature@async_destroy          disabled                       local
test  feature@empty_bpobj            enabled                        local
test  feature@lz4_compress           disabled                       local
test  feature@multi_vdev_crash_dump  disabled                       local
test  feature@spacemap_histogram     disabled                       local
test  feature@enabled_txg            disabled                       local
test  feature@hole_birth             disabled                       local
test  feature@extensible_dataset     disabled                       local
test  feature@embedded_data          active                         local
test  feature@bookmarks              disabled                       local
test  feature@filesystem_limits      disabled                       local
test  feature@large_blocks           disabled                       local

While my system is based on 11-CURRENT, this is documented to work
on 10.0-RELEASE, too:
https://www.freebsd.org/cgi/man.cgi?query=zpool&manpath=FreeBSD+10.0-RELEASE

Given the length of the man page, it probably wouldn't hurt to mention this in the "zpool upgrade" section as well.
Comment 2 Allan Jude freebsd_committer freebsd_triage 2017-07-26 18:05:21 UTC
This is not really a concern. Most all features can be in the 'enabled' state, and still be imported by older versions of ZFS. It is the 'active' state, that means one or more datasets is currently using that feature, and that a system requires that feature in order to read the data. Destroying the last dataset that is using that feature (for example, the skein hashing algo), will revert that feature to 'enabled', and the pool can be imported on a system without that feature.