aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/spa.c
diff options
context:
space:
mode:
authorNed Bass <[email protected]>2015-04-23 12:32:59 -0700
committerBrian Behlendorf <[email protected]>2015-04-24 15:04:43 -0700
commit4eb30c68644c0aacbed9e10d94eff071b2cd76f8 (patch)
tree751fecec325462a50cf9739a87d384f757e90b0e /module/zfs/spa.c
parent7008109646446a3f9dda36bfbd3a526f4f8810ae (diff)
Serialize access to spa->spa_feat_stats nvlist
The function spa_add_feature_stats() manipulates the shared nvlist spa->spa_feat_stats in an unsafe concurrent manner. Add a mutex to protect the list. Signed-off-by: Ned Bass <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3335
Diffstat (limited to 'module/zfs/spa.c')
-rw-r--r--module/zfs/spa.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/module/zfs/spa.c b/module/zfs/spa.c
index 8bee15094..998ec3e54 100644
--- a/module/zfs/spa.c
+++ b/module/zfs/spa.c
@@ -3264,10 +3264,13 @@ spa_feature_stats_from_cache(spa_t *spa, nvlist_t *features)
static void
spa_add_feature_stats(spa_t *spa, nvlist_t *config)
{
- nvlist_t *features = spa->spa_feat_stats;
+ nvlist_t *features;
ASSERT(spa_config_held(spa, SCL_CONFIG, RW_READER));
+ mutex_enter(&spa->spa_feat_stats_lock);
+ features = spa->spa_feat_stats;
+
if (features != NULL) {
spa_feature_stats_from_cache(spa, features);
} else {
@@ -3278,6 +3281,8 @@ spa_add_feature_stats(spa_t *spa, nvlist_t *config)
VERIFY0(nvlist_add_nvlist(config, ZPOOL_CONFIG_FEATURE_STATS,
features));
+
+ mutex_exit(&spa->spa_feat_stats_lock);
}
int