diff options
author | mav <mav@FreeBSD.org> | 2013-08-06 14:41:41 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2013-08-06 14:41:41 +0000 |
commit | 73afbff431cd4ac97e29db7f8fee79baf9751824 (patch) | |
tree | bc638b20d401976ed1d474351b2846f7a2290003 /sys/cddl | |
parent | 55ff4dd4458f4f0d83a2439a00aca55ca830c569 (diff) | |
download | FreeBSD-src-73afbff431cd4ac97e29db7f8fee79baf9751824.zip FreeBSD-src-73afbff431cd4ac97e29db7f8fee79baf9751824.tar.gz |
Block reporting of ZFS features for suspended pools.
Before executing any subcommand, zpool tool fetches pools configuration from
the kernel. Before features support was added, kernel was regenerating that
configuration based on data always present in memory. Unfortunately, pool
features list and activity counters are not such. They are stored in ZAP,
that normally resides in ARC, but under heavy memory pressure may be swapped
out. If pool is suspended at this point, there is no way to recover it back
since any zpool command will stuck.
This change has one predictable flaw: `zpool upgrade` always wish to upgrade
suspended pools, but fortunately it can't do it due to the suspension.
Diffstat (limited to 'sys/cddl')
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c index 9cd7ed8..cd3fb79 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c @@ -3060,6 +3060,10 @@ spa_add_feature_stats(spa_t *spa, nvlist_t *config) ASSERT(spa_config_held(spa, SCL_CONFIG, RW_READER)); VERIFY(nvlist_alloc(&features, NV_UNIQUE_NAME, KM_SLEEP) == 0); + /* We may be unable to read features if pool is suspended. */ + if (spa_suspended(spa)) + goto out; + if (spa->spa_feat_for_read_obj != 0) { for (zap_cursor_init(&zc, spa->spa_meta_objset, spa->spa_feat_for_read_obj); @@ -3086,6 +3090,7 @@ spa_add_feature_stats(spa_t *spa, nvlist_t *config) zap_cursor_fini(&zc); } +out: VERIFY(nvlist_add_nvlist(config, ZPOOL_CONFIG_FEATURE_STATS, features) == 0); nvlist_free(features); |