Merge pull request #680 from robertbaldyga/core-remove-err-recoverable
Make core remove error recoverable
This commit is contained in:
commit
e741160f8d
@ -146,7 +146,10 @@ typedef enum {
|
|||||||
/** Operation invalid with cache drive atatched in failover standby */
|
/** Operation invalid with cache drive atatched in failover standby */
|
||||||
OCF_ERR_STANDBY_ATTACHED,
|
OCF_ERR_STANDBY_ATTACHED,
|
||||||
|
|
||||||
OCF_ERR_MAX = OCF_ERR_STANDBY_ATTACHED,
|
/** Failed to remove the core */
|
||||||
|
OCF_ERR_CORE_NOT_REMOVED,
|
||||||
|
|
||||||
|
OCF_ERR_MAX = OCF_ERR_CORE_NOT_REMOVED,
|
||||||
|
|
||||||
} ocf_error_t;
|
} ocf_error_t;
|
||||||
|
|
||||||
|
@ -632,15 +632,16 @@ static void ocf_mngt_cache_remove_core_finish(ocf_pipeline_t pipeline,
|
|||||||
ocf_pipeline_destroy(context->pipeline);
|
ocf_pipeline_destroy(context->pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ocf_mngt_cache_remove_core_flush_meta_complete(void *priv, int error)
|
static void ocf_mngt_cache_remove_core_flush_collision_complete(void *priv,
|
||||||
|
int error)
|
||||||
{
|
{
|
||||||
struct ocf_mngt_cache_remove_core_context *context = priv;
|
struct ocf_mngt_cache_remove_core_context *context = priv;
|
||||||
|
|
||||||
error = error ? -OCF_ERR_WRITE_CACHE : 0;
|
error = error ? -OCF_ERR_CORE_NOT_REMOVED : 0;
|
||||||
OCF_PL_NEXT_ON_SUCCESS_RET(context->pipeline, error);
|
OCF_PL_NEXT_ON_SUCCESS_RET(context->pipeline, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _ocf_mngt_cache_remove_core_attached(ocf_pipeline_t pipeline,
|
static void _ocf_mngt_cache_remove_core_mapping(ocf_pipeline_t pipeline,
|
||||||
void *priv, ocf_pipeline_arg_t arg)
|
void *priv, ocf_pipeline_arg_t arg)
|
||||||
{
|
{
|
||||||
struct ocf_mngt_cache_remove_core_context *context = priv;
|
struct ocf_mngt_cache_remove_core_context *context = priv;
|
||||||
@ -651,16 +652,24 @@ static void _ocf_mngt_cache_remove_core_attached(ocf_pipeline_t pipeline,
|
|||||||
OCF_PL_NEXT_RET(pipeline);
|
OCF_PL_NEXT_RET(pipeline);
|
||||||
|
|
||||||
cache_mngt_core_deinit_attached_meta(core);
|
cache_mngt_core_deinit_attached_meta(core);
|
||||||
cache_mngt_core_remove_from_cleaning_pol(core);
|
|
||||||
|
|
||||||
if (env_atomic_read(&core->runtime_meta->dirty_clines) == 0)
|
if (env_atomic_read(&core->runtime_meta->dirty_clines) == 0)
|
||||||
OCF_PL_NEXT_RET(pipeline);
|
OCF_PL_NEXT_RET(pipeline);
|
||||||
|
|
||||||
ocf_metadata_flush_collision(cache,
|
ocf_metadata_flush_collision(cache,
|
||||||
ocf_mngt_cache_remove_core_flush_meta_complete,
|
ocf_mngt_cache_remove_core_flush_collision_complete,
|
||||||
context);
|
context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ocf_mngt_cache_remove_core_flush_superblock_complete(void *priv,
|
||||||
|
int error)
|
||||||
|
{
|
||||||
|
struct ocf_mngt_cache_remove_core_context *context = priv;
|
||||||
|
|
||||||
|
error = error ? -OCF_ERR_WRITE_CACHE : 0;
|
||||||
|
OCF_PL_NEXT_ON_SUCCESS_RET(context->pipeline, error);
|
||||||
|
}
|
||||||
|
|
||||||
static void _ocf_mngt_cache_remove_core(ocf_pipeline_t pipeline, void *priv,
|
static void _ocf_mngt_cache_remove_core(ocf_pipeline_t pipeline, void *priv,
|
||||||
ocf_pipeline_arg_t arg)
|
ocf_pipeline_arg_t arg)
|
||||||
{
|
{
|
||||||
@ -670,12 +679,15 @@ static void _ocf_mngt_cache_remove_core(ocf_pipeline_t pipeline, void *priv,
|
|||||||
|
|
||||||
ocf_core_log(core, log_debug, "Removing core\n");
|
ocf_core_log(core, log_debug, "Removing core\n");
|
||||||
|
|
||||||
|
if (ocf_cache_is_device_attached(cache))
|
||||||
|
cache_mngt_core_remove_from_cleaning_pol(core);
|
||||||
|
|
||||||
cache_mngt_core_remove_from_meta(core);
|
cache_mngt_core_remove_from_meta(core);
|
||||||
cache_mngt_core_remove_from_cache(core);
|
cache_mngt_core_remove_from_cache(core);
|
||||||
cache_mngt_core_deinit(core);
|
cache_mngt_core_deinit(core);
|
||||||
|
|
||||||
ocf_metadata_flush_superblock(cache,
|
ocf_metadata_flush_superblock(cache,
|
||||||
ocf_mngt_cache_remove_core_flush_meta_complete,
|
ocf_mngt_cache_remove_core_flush_superblock_complete,
|
||||||
context);
|
context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -705,7 +717,7 @@ struct ocf_pipeline_properties ocf_mngt_cache_remove_core_pipeline_props = {
|
|||||||
.finish = ocf_mngt_cache_remove_core_finish,
|
.finish = ocf_mngt_cache_remove_core_finish,
|
||||||
.steps = {
|
.steps = {
|
||||||
OCF_PL_STEP(ocf_mngt_cache_remove_core_wait_cleaning),
|
OCF_PL_STEP(ocf_mngt_cache_remove_core_wait_cleaning),
|
||||||
OCF_PL_STEP(_ocf_mngt_cache_remove_core_attached),
|
OCF_PL_STEP(_ocf_mngt_cache_remove_core_mapping),
|
||||||
OCF_PL_STEP(_ocf_mngt_cache_remove_core),
|
OCF_PL_STEP(_ocf_mngt_cache_remove_core),
|
||||||
OCF_PL_STEP_TERMINATOR(),
|
OCF_PL_STEP_TERMINATOR(),
|
||||||
},
|
},
|
||||||
|
@ -56,6 +56,7 @@ class OcfErrorCode(IntEnum):
|
|||||||
OCF_ERR_CACHE_STANDBY = auto()
|
OCF_ERR_CACHE_STANDBY = auto()
|
||||||
OCF_ERR_CORE_SIZE_MISMATCH = auto()
|
OCF_ERR_CORE_SIZE_MISMATCH = auto()
|
||||||
OCF_ERR_STANDBY_ATTACHED = auto()
|
OCF_ERR_STANDBY_ATTACHED = auto()
|
||||||
|
OCF_ERR_CORE_NOT_REMOVED = auto()
|
||||||
|
|
||||||
|
|
||||||
class OcfCompletion:
|
class OcfCompletion:
|
||||||
|
Loading…
Reference in New Issue
Block a user