Skip to content

Commit

Permalink
Fix "zpool get guid,freeing,leaked" source
Browse files Browse the repository at this point in the history
`zpool get guid,freeing,leaked` shows SOURCE as `default`, it should
be `-` as those props are not editable.

Changed code to not overwrite `src` for `ZPOOL_PROP_VERSION`, so it
stays `ZPROP_SRC_NONE`.  Make src const to avoid future mistakes

Signed-off-by: Hajo Möller <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs#4170
  • Loading branch information
dasjoe authored and behlendorf committed Aug 30, 2016
1 parent 8fe453b commit 82ab684
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions module/zfs/spa.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ spa_prop_get_config(spa_t *spa, nvlist_t **nvp)
vdev_t *rvd = spa->spa_root_vdev;
dsl_pool_t *pool = spa->spa_dsl_pool;
uint64_t size, alloc, cap, version;
zprop_source_t src = ZPROP_SRC_NONE;
const zprop_source_t src = ZPROP_SRC_NONE;
spa_config_dirent_t *dp;
metaslab_class_t *mc = spa_normal_class(spa);

Expand Down Expand Up @@ -232,11 +232,13 @@ spa_prop_get_config(spa_t *spa, nvlist_t **nvp)
rvd->vdev_state, src);

version = spa_version(spa);
if (version == zpool_prop_default_numeric(ZPOOL_PROP_VERSION))
src = ZPROP_SRC_DEFAULT;
else
src = ZPROP_SRC_LOCAL;
spa_prop_add_list(*nvp, ZPOOL_PROP_VERSION, NULL, version, src);
if (version == zpool_prop_default_numeric(ZPOOL_PROP_VERSION)) {
spa_prop_add_list(*nvp, ZPOOL_PROP_VERSION, NULL,
version, ZPROP_SRC_DEFAULT);
} else {
spa_prop_add_list(*nvp, ZPOOL_PROP_VERSION, NULL,
version, ZPROP_SRC_LOCAL);
}
}

if (pool != NULL) {
Expand Down

0 comments on commit 82ab684

Please sign in to comment.