Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Mar 2021 09:37:34 GMT
From:      Martin Matuska <mm@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: ee36544bd811 - stable/13 - zfs: add missing checks for unsupported features
Message-ID:  <202103100937.12A9bY6O014473@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by mm:

URL: https://cgit.FreeBSD.org/src/commit/?id=ee36544bd8113595dc15034cae2dfa83a7014751

commit ee36544bd8113595dc15034cae2dfa83a7014751
Author:     Martin Matuska <mm@FreeBSD.org>
AuthorDate: 2021-02-26 21:52:41 +0000
Commit:     Martin Matuska <mm@FreeBSD.org>
CommitDate: 2021-03-10 01:57:03 +0000

    zfs: add missing checks for unsupported features
    
    After the merge of OpenZFS master-9312e0fd1 it has become possible to
    import ZFS pools witn an active org.illumos:edonr feature on FreeBSD,
    leading to a panic.
    
    In addition, "zpool status" reported all pools without edonr as upgradable
    and "zpool upgrade -v" lists edonr in the list of upgradable features.
    
    This is an accepted but not yet included bugfix by upstream.
    
    Obtained from:          https://github.com/openzfs/zfs/pull/11653
    Differential Revision:  https://reviews.freebsd.org/D28935
    Reported by:            garga (on freebsd-current@)
    Reviewed by:            freqlabs
    
    (cherry picked from commit c170aa9f37e4ce9338a0f26e3e983f7123ea8c1a)
---
 sys/contrib/openzfs/cmd/zpool/zpool_main.c           | 2 ++
 sys/contrib/openzfs/cmd/ztest/ztest.c                | 3 +++
 sys/contrib/openzfs/lib/libzfs/libzfs_status.c       | 2 ++
 sys/contrib/openzfs/module/zcommon/zfeature_common.c | 2 ++
 4 files changed, 9 insertions(+)

diff --git a/sys/contrib/openzfs/cmd/zpool/zpool_main.c b/sys/contrib/openzfs/cmd/zpool/zpool_main.c
index 29252e6a24f4..e89eb3bea770 100644
--- a/sys/contrib/openzfs/cmd/zpool/zpool_main.c
+++ b/sys/contrib/openzfs/cmd/zpool/zpool_main.c
@@ -9030,6 +9030,8 @@ zpool_do_upgrade(int argc, char **argv)
 		    "---------------\n");
 		for (i = 0; i < SPA_FEATURES; i++) {
 			zfeature_info_t *fi = &spa_feature_table[i];
+			if (!fi->fi_zfs_mod_supported)
+				continue;
 			const char *ro =
 			    (fi->fi_flags & ZFEATURE_FLAG_READONLY_COMPAT) ?
 			    " (read-only compatible)" : "";
diff --git a/sys/contrib/openzfs/cmd/ztest/ztest.c b/sys/contrib/openzfs/cmd/ztest/ztest.c
index cfa1290d78d1..1a030280704a 100644
--- a/sys/contrib/openzfs/cmd/ztest/ztest.c
+++ b/sys/contrib/openzfs/cmd/ztest/ztest.c
@@ -7592,6 +7592,9 @@ ztest_init(ztest_shared_t *zs)
 	for (i = 0; i < SPA_FEATURES; i++) {
 		char *buf;
 
+		if (!spa_feature_table[i].fi_zfs_mod_supported)
+			continue;
+
 		/*
 		 * 75% chance of using the log space map feature. We want ztest
 		 * to exercise both the code paths that use the log space map
diff --git a/sys/contrib/openzfs/lib/libzfs/libzfs_status.c b/sys/contrib/openzfs/lib/libzfs/libzfs_status.c
index fadae9388ac1..5e5cb5f5d440 100644
--- a/sys/contrib/openzfs/lib/libzfs/libzfs_status.c
+++ b/sys/contrib/openzfs/lib/libzfs/libzfs_status.c
@@ -482,6 +482,8 @@ check_status(nvlist_t *config, boolean_t isimport,
 			return (ZPOOL_STATUS_COMPATIBILITY_ERR);
 		for (i = 0; i < SPA_FEATURES; i++) {
 			zfeature_info_t *fi = &spa_feature_table[i];
+			if (!fi->fi_zfs_mod_supported)
+				continue;
 			if (pool_features[i] &&
 			    !nvlist_exists(feat, fi->fi_guid))
 				return (ZPOOL_STATUS_FEAT_DISABLED);
diff --git a/sys/contrib/openzfs/module/zcommon/zfeature_common.c b/sys/contrib/openzfs/module/zcommon/zfeature_common.c
index e95a85e89ba2..fc0e09605eef 100644
--- a/sys/contrib/openzfs/module/zcommon/zfeature_common.c
+++ b/sys/contrib/openzfs/module/zcommon/zfeature_common.c
@@ -100,6 +100,8 @@ zfeature_is_supported(const char *guid)
 
 	for (spa_feature_t i = 0; i < SPA_FEATURES; i++) {
 		zfeature_info_t *feature = &spa_feature_table[i];
+		if (!feature->fi_zfs_mod_supported)
+			continue;
 		if (strcmp(guid, feature->fi_guid) == 0)
 			return (B_TRUE);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103100937.12A9bY6O014473>