Merge pull request #1131 from mmichal10/remain-standby

Remain standby
This commit is contained in:
Robert Baldyga 2022-03-24 09:33:25 +01:00 committed by GitHub
commit 3c2fd8059c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2352,6 +2352,9 @@ int cache_mngt_activate(struct ocf_mngt_cache_standby_activate_config *cfg,
cache_priv = ocf_cache_get_priv(cache); cache_priv = ocf_cache_get_priv(cache);
cache_priv->attach_context = context; cache_priv->attach_context = context;
/* All the required memory has been alocated and initialized on cache_init,
* just set the flag to allow deinit*/
context->priv_inited = true;
context->rollback_thread = cas_lazy_thread_create(cache_start_rollback, context->rollback_thread = cas_lazy_thread_create(cache_start_rollback,
context, "cas_cache_rollback_complete"); context, "cas_cache_rollback_complete");
@ -2369,12 +2372,13 @@ int cache_mngt_activate(struct ocf_mngt_cache_standby_activate_config *cfg,
if (result == -KCAS_ERR_WAITING_INTERRUPTED) if (result == -KCAS_ERR_WAITING_INTERRUPTED)
goto out_cache_put; goto out_cache_put;
if (result) if (result)
goto err; goto activate_err;
result = _cache_start_finalize(cache, -1, true); result = _cache_start_finalize(cache, -1, true);
if (result) if (result)
goto err; goto finalize_err;
activate_err:
cas_lazy_thread_stop(context->rollback_thread); cas_lazy_thread_stop(context->rollback_thread);
err_free_context: err_free_context:
@ -2389,7 +2393,7 @@ out_module_put:
module_put(THIS_MODULE); module_put(THIS_MODULE);
return result; return result;
err: finalize_err:
_cache_mngt_async_context_reinit(&context->async); _cache_mngt_async_context_reinit(&context->async);
ocf_mngt_cache_stop(cache, _cache_mngt_cache_stop_rollback_complete, ocf_mngt_cache_stop(cache, _cache_mngt_cache_stop_rollback_complete,
context); context);
@ -2401,6 +2405,7 @@ err:
if (rollback_result != -KCAS_ERR_WAITING_INTERRUPTED) if (rollback_result != -KCAS_ERR_WAITING_INTERRUPTED)
kfree(context); kfree(context);
module_put(THIS_MODULE);
return result; return result;
} }