diff --git a/src/mngt/ocf_mngt_cache.c b/src/mngt/ocf_mngt_cache.c index 5566228..f1575a1 100644 --- a/src/mngt/ocf_mngt_cache.c +++ b/src/mngt/ocf_mngt_cache.c @@ -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); diff --git a/src/mngt/ocf_mngt_core.c b/src/mngt/ocf_mngt_core.c index c32e033..cc6dc93 100644 --- a/src/mngt/ocf_mngt_core.c +++ b/src/mngt/ocf_mngt_core.c @@ -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);