Merge pull request #293 from robertbaldyga/deinit-cache-lock-on-stop

Deinitialize locks on cache stop instead of put
This commit is contained in:
Adam Rutkowski 2019-09-27 15:14:31 +02:00 committed by GitHub
commit d6739441de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -1986,10 +1986,15 @@ static void ocf_mngt_cache_stop_put_io_queues(ocf_pipeline_t pipeline,
static void ocf_mngt_cache_remove(ocf_ctx_t ctx, ocf_cache_t cache)
{
env_rmutex_lock(&ctx->lock);
/* Mark device uninitialized */
ocf_refcnt_freeze(&cache->refcnt.cache);
/* Deinitialize locks */
ocf_mngt_cache_lock_deinit(cache);
env_mutex_destroy(&cache->flush_mutex);
/* Remove cache from the list */
env_rmutex_lock(&ctx->lock);
list_del(&cache->list);
env_rmutex_unlock(&ctx->lock);
}

View File

@ -135,8 +135,6 @@ void ocf_mngt_cache_put(ocf_cache_t cache)
if (ocf_refcnt_dec(&cache->refcnt.cache) == 0) {
ctx = cache->owner;
ocf_metadata_deinit(cache);
ocf_mngt_cache_lock_deinit(cache);
env_mutex_destroy(&cache->flush_mutex);
env_vfree(cache);
ocf_ctx_put(ctx);
}