More specific error msg for core statistics in standby

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
Adam Rutkowski 2022-03-29 22:18:25 +02:00
parent aa3c33050d
commit 02dbc56eba

View File

@ -778,6 +778,17 @@ int cache_status(unsigned int cache_id, unsigned int core_id, int io_class_id,
goto cleanup; goto cleanup;
} }
if ((cache_info.info.state & (1 << ocf_cache_state_standby)) &&
core_id != OCF_CORE_ID_INVALID) {
/* Explicitly fail due to standby mode rather than
* bouncing off the fact that there are 0 cores in the
* cache and saying "no such core device"
*/
print_err(OCF_ERR_CACHE_STANDBY);
ret = FAILURE;
goto cleanup;
}
/* Check if core exists in cache */ /* Check if core exists in cache */
if (core_id != OCF_CORE_ID_INVALID) { if (core_id != OCF_CORE_ID_INVALID) {
for (i = 0; i < cache_info.info.core_count; ++i) { for (i = 0; i < cache_info.info.core_count; ++i) {