diff options
author | Christopher Siden <[email protected]> | 2012-12-14 15:00:45 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2013-01-08 10:35:43 -0800 |
commit | b9b24bb4ca45f2d903efadba44d10dfd182f62ac (patch) | |
tree | 66851e088971be7fbeed9f938227caf5295216b8 /module | |
parent | 3bc7e0fb0f3904eaf41e0b9768ebe2d042ae98aa (diff) |
Illumos #2762: zpool command should have better support for feature flags
2762 zpool command should have better support for feature flags
Reviewed by: Matthew Ahrens <[email protected]>
Reviewed by: George Wilson <[email protected]>
Approved by: Eric Schrock <[email protected]>
References:
illumos/illumos-gate@57221772c3fc05faba04bf48ddff45abf2bbf2bd
https://www.illumos.org/issues/2762
Ported-by: Brian Behlendorf <[email protected]>
Diffstat (limited to 'module')
-rw-r--r-- | module/zfs/spa.c | 21 | ||||
-rw-r--r-- | module/zfs/zfeature.c | 9 |
2 files changed, 20 insertions, 10 deletions
diff --git a/module/zfs/spa.c b/module/zfs/spa.c index 59c43f40c..0a785f78a 100644 --- a/module/zfs/spa.c +++ b/module/zfs/spa.c @@ -2209,7 +2209,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config, if (spa_version(spa) >= SPA_VERSION_FEATURES) { boolean_t missing_feat_read = B_FALSE; - nvlist_t *unsup_feat; + nvlist_t *unsup_feat, *enabled_feat; if (spa_dir_prop(spa, DMU_POOL_FEATURES_FOR_READ, &spa->spa_feat_for_read_obj) != 0) { @@ -2226,27 +2226,32 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config, return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); } - VERIFY(nvlist_alloc(&unsup_feat, NV_UNIQUE_NAME, KM_SLEEP) == - 0); + enabled_feat = fnvlist_alloc(); + unsup_feat = fnvlist_alloc(); if (!feature_is_supported(spa->spa_meta_objset, spa->spa_feat_for_read_obj, spa->spa_feat_desc_obj, - unsup_feat)) + unsup_feat, enabled_feat)) missing_feat_read = B_TRUE; if (spa_writeable(spa) || state == SPA_LOAD_TRYIMPORT) { if (!feature_is_supported(spa->spa_meta_objset, spa->spa_feat_for_write_obj, spa->spa_feat_desc_obj, - unsup_feat)) + unsup_feat, enabled_feat)) { missing_feat_write = B_TRUE; + } } + fnvlist_add_nvlist(spa->spa_load_info, + ZPOOL_CONFIG_ENABLED_FEAT, enabled_feat); + if (!nvlist_empty(unsup_feat)) { - VERIFY(nvlist_add_nvlist(spa->spa_load_info, - ZPOOL_CONFIG_UNSUP_FEAT, unsup_feat) == 0); + fnvlist_add_nvlist(spa->spa_load_info, + ZPOOL_CONFIG_UNSUP_FEAT, unsup_feat); } - nvlist_free(unsup_feat); + fnvlist_free(enabled_feat); + fnvlist_free(unsup_feat); if (!missing_feat_read) { fnvlist_add_boolean(spa->spa_load_info, diff --git a/module/zfs/zfeature.c b/module/zfs/zfeature.c index de9d165a9..24ff18fc3 100644 --- a/module/zfs/zfeature.c +++ b/module/zfs/zfeature.c @@ -173,7 +173,7 @@ typedef enum { */ boolean_t feature_is_supported(objset_t *os, uint64_t obj, uint64_t desc_obj, - nvlist_t *unsup_feat) + nvlist_t *unsup_feat, nvlist_t *enabled_feat) { boolean_t supported; zap_cursor_t *zc; @@ -191,11 +191,16 @@ feature_is_supported(objset_t *os, uint64_t obj, uint64_t desc_obj, ASSERT(za->za_integer_length == sizeof (uint64_t) && za->za_num_integers == 1); + if (NULL != enabled_feat) { + fnvlist_add_uint64(enabled_feat, za->za_name, + za->za_first_integer); + } + if (za->za_first_integer != 0 && !zfeature_is_supported(za->za_name)) { supported = B_FALSE; - if (unsup_feat != NULL) { + if (NULL != unsup_feat) { char *desc = ""; if (zap_lookup(os, desc_obj, za->za_name, |