mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-26 04:07:45 +03:00
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 <bass6@llnl.gov> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #3335
This commit is contained in:
committed by
Brian Behlendorf
parent
7008109646
commit
4eb30c6864
+6
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user