Merge pull request #46 from micrakow/cache_stop_dirty_bug_on
Added check for dirty cache/core during cache stop/core removal
This commit is contained in:
commit
e4b603396b
@ -713,7 +713,7 @@ int cache_mngt_remove_core_from_cache(struct kcas_remove_core *cmd)
|
|||||||
return result;
|
return result;
|
||||||
|
|
||||||
if (!cmd->force_no_flush) {
|
if (!cmd->force_no_flush) {
|
||||||
/* First check state and flush data (if requested by user)
|
/* First check state and flush data (if requested by user)
|
||||||
under read lock */
|
under read lock */
|
||||||
result = _cache_mngt_read_lock_sync(cache);
|
result = _cache_mngt_read_lock_sync(cache);
|
||||||
if (result)
|
if (result)
|
||||||
@ -766,6 +766,9 @@ int cache_mngt_remove_core_from_cache(struct kcas_remove_core *cmd)
|
|||||||
_cache_mngt_remove_core_complete, &context);
|
_cache_mngt_remove_core_complete, &context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!cmd->force_no_flush && !flush_result)
|
||||||
|
BUG_ON(ocf_mngt_core_is_dirty(core));
|
||||||
|
|
||||||
wait_for_completion(&context.compl);
|
wait_for_completion(&context.compl);
|
||||||
|
|
||||||
if (!result && flush_result)
|
if (!result && flush_result)
|
||||||
@ -1614,6 +1617,9 @@ int cache_mngt_exit_instance(ocf_cache_id_t id, int flush)
|
|||||||
if (flush)
|
if (flush)
|
||||||
flush_status = _cache_mngt_cache_flush_sync(cache, false);
|
flush_status = _cache_mngt_cache_flush_sync(cache, false);
|
||||||
|
|
||||||
|
if (flush && !flush_status)
|
||||||
|
BUG_ON(ocf_mngt_cache_is_dirty(cache));
|
||||||
|
|
||||||
/* Stop cache device */
|
/* Stop cache device */
|
||||||
status = _cache_mngt_cache_stop_sync(cache);
|
status = _cache_mngt_cache_stop_sync(cache);
|
||||||
if (status && status != -OCF_ERR_WRITE_CACHE)
|
if (status && status != -OCF_ERR_WRITE_CACHE)
|
||||||
|
Loading…
Reference in New Issue
Block a user