Return error on cache mode change in standby mode

Changing cache mode to the same mode is a special case that in OCL is
handled on the kernel level, without calling an OCF API. In result it
seemed to succeed even in standby mode, which should return an error.

Explicitly check for standby to return an appropriate error code.


Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Robert Baldyga 2022-03-27 21:31:29 +02:00
parent f98a2862b0
commit 4c431bf71c

View File

@ -2792,6 +2792,11 @@ int cache_mngt_set_cache_mode(const char *cache_name, size_t name_len,
if (result)
return result;
if (ocf_cache_is_standby(cache)) {
result = -OCF_ERR_CACHE_STANDBY;
goto put;
}
old_mode = ocf_cache_get_mode(cache);
if (old_mode == mode) {
printk(KERN_INFO "%s is in requested cache mode already\n", cache_name);