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:
commit
a2272266f6
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user