Merge pull request #635 from robertbaldyga/fix-closing-volume-stanby-stop
Fix closing volume on standby stop
This commit is contained in:
commit
02ea894252
@ -1748,6 +1748,7 @@ struct ocf_mngt_cache_stop_context {
|
||||
ocf_ctx_t ctx;
|
||||
char cache_name[OCF_CACHE_NAME_SIZE];
|
||||
int cache_write_error;
|
||||
bool close_volume;
|
||||
};
|
||||
|
||||
static void ocf_mngt_cache_stop_wait_metadata_io_finish(void *priv)
|
||||
@ -2442,6 +2443,17 @@ static void _ocf_mngt_cache_load(ocf_cache_t cache,
|
||||
OCF_PL_NEXT_RET(pipeline);
|
||||
}
|
||||
|
||||
static void ocf_mngt_stop_standby_stop_prepare(ocf_pipeline_t pipeline,
|
||||
void *priv, ocf_pipeline_arg_t arg)
|
||||
{
|
||||
struct ocf_mngt_cache_stop_context *context = priv;
|
||||
ocf_cache_t cache = context->cache;
|
||||
|
||||
context->close_volume = !ocf_refcnt_frozen(&cache->refcnt.metadata);
|
||||
|
||||
ocf_pipeline_next(pipeline);
|
||||
}
|
||||
|
||||
static void ocf_mngt_stop_standby_stop_cleaner(ocf_pipeline_t pipeline,
|
||||
void *priv, ocf_pipeline_arg_t arg)
|
||||
{
|
||||
@ -2459,7 +2471,7 @@ static void ocf_mngt_cache_standby_close_cache_volume(ocf_pipeline_t pipeline,
|
||||
struct ocf_mngt_cache_stop_context *context = priv;
|
||||
ocf_cache_t cache = context->cache;
|
||||
|
||||
if (!ocf_refcnt_frozen(&cache->refcnt.metadata))
|
||||
if (context->close_volume)
|
||||
ocf_volume_close(&cache->device->volume);
|
||||
|
||||
ocf_pipeline_next(pipeline);
|
||||
@ -2486,6 +2498,7 @@ ocf_mngt_cache_stop_standby_pipeline_properties = {
|
||||
.priv_size = sizeof(struct ocf_mngt_cache_stop_context),
|
||||
.finish = ocf_mngt_cache_stop_finish,
|
||||
.steps = {
|
||||
OCF_PL_STEP(ocf_mngt_stop_standby_stop_prepare),
|
||||
OCF_PL_STEP(ocf_mngt_cache_stop_wait_metadata_io),
|
||||
OCF_PL_STEP(ocf_mngt_stop_standby_stop_cleaner),
|
||||
OCF_PL_STEP(ocf_mngt_cache_standby_close_cache_volume),
|
||||
|
Loading…
Reference in New Issue
Block a user