Merge pull request #439 from mmichal10/fix-upgrade-restore

Fix upgrade restore
This commit is contained in:
Robert Baldyga 2020-06-16 14:27:01 +02:00 committed by GitHub
commit 9d7ab478da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1836,7 +1836,7 @@ static void init_instance_complete(struct _cache_mngt_attach_context *ctx,
/* Set other back information */ /* Set other back information */
name = block_dev_get_elevator_name( name = block_dev_get_elevator_name(
casdsk_disk_get_queue(bd_cache_obj->dsk)); casdsk_disk_get_queue(bd_cache_obj->dsk));
if (name) if (name && ctx->cmd)
strlcpy(ctx->cmd->cache_elevator, strlcpy(ctx->cmd->cache_elevator,
name, MAX_ELEVATOR_NAME); name, MAX_ELEVATOR_NAME);
} }
@ -1848,6 +1848,7 @@ static void cache_start_finalize(struct work_struct *work)
{ {
struct cache_priv *cache_priv = struct cache_priv *cache_priv =
container_of(work, struct cache_priv, start_worker); container_of(work, struct cache_priv, start_worker);
struct task_struct *rollback_thread;
struct _cache_mngt_attach_context *ctx = cache_priv->attach_context; struct _cache_mngt_attach_context *ctx = cache_priv->attach_context;
int result; int result;
ocf_cache_t cache = ctx->cache; ocf_cache_t cache = ctx->cache;
@ -1870,6 +1871,8 @@ static void cache_start_finalize(struct work_struct *work)
init_instance_complete(ctx, cache); init_instance_complete(ctx, cache);
rollback_thread = ctx->rollback_thread;
if (_cache_mngt_async_callee_set_result(&ctx->async, 0)) { if (_cache_mngt_async_callee_set_result(&ctx->async, 0)) {
/* caller interrupted */ /* caller interrupted */
ctx->ocf_start_error = 0; ctx->ocf_start_error = 0;
@ -1878,7 +1881,7 @@ static void cache_start_finalize(struct work_struct *work)
return; return;
} }
kthread_stop(ctx->rollback_thread); kthread_stop(rollback_thread);
ocf_mngt_cache_unlock(cache); ocf_mngt_cache_unlock(cache);
} }
@ -1890,7 +1893,7 @@ static void _cache_mngt_start_complete(ocf_cache_t cache, void *priv, int error)
int caller_status = _cache_mngt_async_callee_peek_result(&ctx->async); int caller_status = _cache_mngt_async_callee_peek_result(&ctx->async);
if (caller_status || error) { if (caller_status || error) {
if (error == -OCF_ERR_NO_FREE_RAM) { if (error == -OCF_ERR_NO_FREE_RAM && ctx->cmd) {
ocf_mngt_get_ram_needed(cache, ctx->device_cfg, ocf_mngt_get_ram_needed(cache, ctx->device_cfg,
&ctx->cmd->min_free_ram); &ctx->cmd->min_free_ram);
} else if (caller_status == -KCAS_ERR_WAITING_INTERRUPTED) { } else if (caller_status == -KCAS_ERR_WAITING_INTERRUPTED) {