Manage valid_core_bitmap properly
Set bit only on core addition and clean it on core removal. This allows to avoid conf metadata modification in load / standby load paths, which effectively prevents issues with metadata mismatch during consequent standby activate attempts after initial activate failure. Previously the first attempt changed the metadata, so on comparison with metadata on drive failed on any following attempt, leading to inability to activate the cache. Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
parent
d550c8f4ef
commit
9c751dd2b8
@ -312,7 +312,7 @@ static void _ocf_mngt_close_all_uninitialized_cores(
|
||||
int j, i;
|
||||
|
||||
for (j = cache->conf_meta->core_count, i = 0; j > 0; ++i) {
|
||||
if (!env_bit_test(i, cache->conf_meta->valid_core_bitmap))
|
||||
if (!cache->core[i].added)
|
||||
continue;
|
||||
|
||||
volume = &(cache->core[i].volume);
|
||||
@ -326,8 +326,7 @@ static void _ocf_mngt_close_all_uninitialized_cores(
|
||||
|
||||
env_free(cache->core[i].counters);
|
||||
cache->core[i].counters = NULL;
|
||||
|
||||
env_bit_clear(i, cache->conf_meta->valid_core_bitmap);
|
||||
cache->core[i].added = false;
|
||||
}
|
||||
|
||||
cache->conf_meta->core_count = 0;
|
||||
@ -401,7 +400,6 @@ static void _ocf_mngt_load_add_cores(ocf_pipeline_t pipeline,
|
||||
}
|
||||
|
||||
}
|
||||
env_bit_set(core_id, cache->conf_meta->valid_core_bitmap);
|
||||
core->added = true;
|
||||
cache->conf_meta->core_count++;
|
||||
core->volume.cache = cache;
|
||||
@ -1963,10 +1961,7 @@ static void _ocf_mngt_cache_stop_remove_cores(ocf_cache_t cache, bool attached)
|
||||
int no = cache->conf_meta->core_count;
|
||||
|
||||
/* All exported objects removed, cleaning up rest. */
|
||||
for_each_core_all(cache, core, core_id) {
|
||||
if (!env_bit_test(core_id, cache->conf_meta->valid_core_bitmap))
|
||||
continue;
|
||||
|
||||
for_each_core(cache, core, core_id) {
|
||||
cache_mngt_core_remove_from_cache(core);
|
||||
if (attached)
|
||||
cache_mngt_core_remove_from_cleaning_pol(core);
|
||||
|
@ -106,6 +106,7 @@ void cache_mngt_core_deinit_attached_meta(ocf_core_t core)
|
||||
void cache_mngt_core_remove_from_meta(ocf_core_t core)
|
||||
{
|
||||
ocf_cache_t cache = ocf_core_get_cache(core);
|
||||
ocf_core_id_t core_id = ocf_core_get_id(core);
|
||||
|
||||
ocf_metadata_start_exclusive_access(&cache->metadata.lock);
|
||||
|
||||
@ -116,6 +117,8 @@ void cache_mngt_core_remove_from_meta(ocf_core_t core)
|
||||
ocf_mngt_core_clear_uuid_metadata(core);
|
||||
core->conf_meta->seq_no = OCF_SEQ_NO_INVALID;
|
||||
|
||||
env_bit_clear(core_id, cache->conf_meta->valid_core_bitmap);
|
||||
|
||||
ocf_metadata_end_exclusive_access(&cache->metadata.lock);
|
||||
}
|
||||
|
||||
@ -123,13 +126,11 @@ void cache_mngt_core_remove_from_meta(ocf_core_t core)
|
||||
void cache_mngt_core_remove_from_cache(ocf_core_t core)
|
||||
{
|
||||
ocf_cache_t cache = ocf_core_get_cache(core);
|
||||
ocf_core_id_t core_id = ocf_core_get_id(core);
|
||||
|
||||
ocf_core_seq_cutoff_deinit(core);
|
||||
env_free(core->counters);
|
||||
core->counters = NULL;
|
||||
core->added = false;
|
||||
env_bit_clear(core_id, cache->conf_meta->valid_core_bitmap);
|
||||
|
||||
if (!core->opened && --cache->ocf_core_inactive_count == 0)
|
||||
env_bit_clear(ocf_cache_state_incomplete, &cache->cache_state);
|
||||
|
Loading…
Reference in New Issue
Block a user