From 3b0236aca9b6fedffad09e885c31182a64c8169b Mon Sep 17 00:00:00 2001 From: Robert Baldyga Date: Wed, 28 Jul 2021 15:22:35 +0200 Subject: [PATCH 1/2] Fix error message when removing unplugged cache Signed-off-by: Robert Baldyga --- casadm/cas_lib.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/casadm/cas_lib.c b/casadm/cas_lib.c index 13936f8..589f73c 100644 --- a/casadm/cas_lib.c +++ b/casadm/cas_lib.c @@ -1153,6 +1153,10 @@ int stop_cache(uint16_t cache_id, int flush) "to operate normally. If you want to stop cache without fully\n" "flushing dirty data, use '-n' option.\n"); return INTERRUPTED; + } else if (cmd.ext_err_code == OCF_ERR_WRITE_CACHE){ + cas_printf(LOG_ERR, "Removed cache %d with errors\n", cache_id); + print_err(cmd.ext_err_code); + return FAILURE; } else { cas_printf(LOG_ERR, "Error while removing cache %d\n", cache_id); print_err(cmd.ext_err_code); From a98473afacb093192e568e3a6b31e72bf0cf4142 Mon Sep 17 00:00:00 2001 From: Robert Baldyga Date: Wed, 28 Jul 2021 15:49:46 +0200 Subject: [PATCH 2/2] Better detect if the same device is being added twice Signed-off-by: Robert Baldyga --- casadm/cas_lib.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/casadm/cas_lib.c b/casadm/cas_lib.c index 589f73c..f6a9f9e 100644 --- a/casadm/cas_lib.c +++ b/casadm/cas_lib.c @@ -1070,8 +1070,7 @@ int start_cache(uint16_t cache_id, unsigned int cache_init, return FAILURE; } else { cas_printf(LOG_ERR, "Error inserting cache %d\n", cache_id); - if (OCF_ERR_NOT_OPEN_EXC == cmd.ext_err_code && - FAILURE == check_cache_already_added(cache_device)) { + if (FAILURE == check_cache_already_added(cache_device)) { cas_printf(LOG_ERR, "Cache device '%s' is already used as cache.\n", cache_device); } else {