Zero metadata if on-disk version differs from current

Kernel adapter now returns is_cache_device=1 and newly added
metadata_compatible=0 in case of metadata detected with
differing version (instead of is_cache_device = 0).

This allows zero-superblock command to recognize old
cache instance and clear it.

casadm --script --check-cache-device still returns 'Is cache'='no'
in this case, as this layer only cares about metadata in current
version to be able to detect dirty datas tatus.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
Adam Rutkowski
2021-01-21 14:31:00 -06:00
parent 63eb23ba40
commit 68b68db9c0
3 changed files with 14 additions and 3 deletions

View File

@@ -1012,11 +1012,17 @@ static void cache_mngt_metadata_probe_end(void *priv, int error,
*context->result = error;
if (error == -OCF_ERR_NO_METADATA || error == -OCF_ERR_METADATA_VER) {
if (error == -OCF_ERR_NO_METADATA) {
cmd_info->is_cache_device = false;
cmd_info->metadata_compatible = false;
*context->result = 0;
} else if (error == -OCF_ERR_METADATA_VER) {
cmd_info->is_cache_device = true;
cmd_info->metadata_compatible = false;
*context->result = 0;
} else if (error == 0) {
cmd_info->is_cache_device = true;
cmd_info->metadata_compatible = true;
cmd_info->clean_shutdown = status->clean_shutdown;
cmd_info->cache_dirty = status->cache_dirty;
}