Merge pull request #900 from robertbaldyga/error-handling-fixes

Error handling fixes
This commit is contained in:
Robert Baldyga 2021-07-28 16:04:55 +02:00 committed by GitHub
commit 9e3869e659
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1070,8 +1070,7 @@ int start_cache(uint16_t cache_id, unsigned int cache_init,
return FAILURE; return FAILURE;
} else { } else {
cas_printf(LOG_ERR, "Error inserting cache %d\n", cache_id); cas_printf(LOG_ERR, "Error inserting cache %d\n", cache_id);
if (OCF_ERR_NOT_OPEN_EXC == cmd.ext_err_code && if (FAILURE == check_cache_already_added(cache_device)) {
FAILURE == check_cache_already_added(cache_device)) {
cas_printf(LOG_ERR, "Cache device '%s' is already used as cache.\n", cas_printf(LOG_ERR, "Cache device '%s' is already used as cache.\n",
cache_device); cache_device);
} else { } else {
@ -1153,6 +1152,10 @@ int stop_cache(uint16_t cache_id, int flush)
"to operate normally. If you want to stop cache without fully\n" "to operate normally. If you want to stop cache without fully\n"
"flushing dirty data, use '-n' option.\n"); "flushing dirty data, use '-n' option.\n");
return INTERRUPTED; 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 { } else {
cas_printf(LOG_ERR, "Error while removing cache %d\n", cache_id); cas_printf(LOG_ERR, "Error while removing cache %d\n", cache_id);
print_err(cmd.ext_err_code); print_err(cmd.ext_err_code);