Disable load operation with 'force' flag

Fail `ocf_mngt_cache_load` function with `OCF_ERR_INVAL`
error code when force flag is in use.
Log error message.

Closes #361

Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
This commit is contained in:
Slawomir Jankowski 2020-05-20 12:30:47 +02:00
parent 1c9312842a
commit 544e4086ca

View File

@ -2077,6 +2077,13 @@ void ocf_mngt_cache_load(ocf_cache_t cache,
if (cache->metadata.is_volatile)
OCF_CMPL_RET(cache, priv, -EINVAL);
/* Load is not allowed with 'force' flag on */
if (cfg->force) {
ocf_cache_log(cache, log_err, "Using 'force' flag is forbidden "
"for load operation.");
OCF_CMPL_RET(cache, priv, -OCF_ERR_INVAL);
}
result = _ocf_mngt_cache_validate_device_cfg(cfg);
if (result)
OCF_CMPL_RET(cache, priv, result);