Merge pull request #864 from Open-CAS/fix_detached_check

Check if cache is attached before setting promotion and seqcutoff params
This commit is contained in:
Robert Baldyga 2025-03-12 11:05:40 +01:00 committed by GitHub
commit a2272266f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View File

@ -3733,6 +3733,9 @@ int ocf_mngt_cache_promotion_set_param(ocf_cache_t cache, ocf_promotion_t type,
if (ocf_cache_is_standby(cache))
return -OCF_ERR_CACHE_STANDBY;
if (!ocf_cache_is_device_attached(cache))
return -OCF_ERR_CACHE_DETACHED;
ocf_metadata_start_exclusive_access(&cache->metadata.lock);
result = ocf_promotion_set_param(cache, type, param_id, param_value);

View File

@ -1258,6 +1258,9 @@ int ocf_mngt_core_set_seq_cutoff_promote_on_threshold(ocf_core_t core,
if (ocf_cache_is_standby(cache))
return -OCF_ERR_CACHE_STANDBY;
if (!ocf_cache_is_device_attached(cache))
return -OCF_ERR_CACHE_DETACHED;
return _cache_mngt_set_core_seq_cutoff_promote_on_threshold(core, &promote);
}
@ -1269,6 +1272,9 @@ int ocf_mngt_core_set_seq_cutoff_promote_on_threshold_all(ocf_cache_t cache,
if (ocf_cache_is_standby(cache))
return -OCF_ERR_CACHE_STANDBY;
if (!ocf_cache_is_device_attached(cache))
return -OCF_ERR_CACHE_DETACHED;
return ocf_core_visit(cache,
_cache_mngt_set_core_seq_cutoff_promote_on_threshold,
&promote, true);