git: 9005e81aa014 - stable/12 - loader: we should support pools without features

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Fri, 08 Oct 2021 06:11:29 UTC
The branch stable/12 has been updated by kevans:

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

commit 9005e81aa014d283c8156173d61d7b3b656f5746
Author:     Toomas Soome <tsoome@FreeBSD.org>
AuthorDate: 2021-04-02 23:40:51 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2021-10-08 05:24:28 +0000

    loader: we should support pools without features
    
    nvlist_check_features_for_read() does return error when there
    are no features for read.
    
    (cherry picked from commit d36341f7b8ddc2457a1e9e4a721d27d2e66cb39a)
---
 stand/libsa/zfs/zfsimpl.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/stand/libsa/zfs/zfsimpl.c b/stand/libsa/zfs/zfsimpl.c
index e3eb0a0b6a89..70e44d7f0e8b 100644
--- a/stand/libsa/zfs/zfsimpl.c
+++ b/stand/libsa/zfs/zfsimpl.c
@@ -183,8 +183,16 @@ nvlist_check_features_for_read(nvlist_t *nvl)
 
 	rc = nvlist_find(nvl, ZPOOL_CONFIG_FEATURES_FOR_READ,
 	    DATA_TYPE_NVLIST, NULL, &features, NULL);
-	if (rc != 0)
-		return (rc);
+	switch (rc) {
+	case 0:
+		break;		/* Continue with checks */
+
+	case ENOENT:
+		return (0);	/* All features are disabled */
+
+	default:
+		return (rc);	/* Error while reading nvlist */
+	}
 
 	data = (nvs_data_t *)features->nv_data;
 	nvp = &data->nvl_pair;	/* first pair in nvlist */