Don't access cache priv before locking cache
Cache priv may be freed by concurrent stop. Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com> Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
This commit is contained in:
parent
79a73fded2
commit
72594436ce
@ -3199,10 +3199,6 @@ int cache_mngt_exit_instance(const char *cache_name, size_t name_len, int flush)
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
cache_priv = ocf_cache_get_priv(cache);
|
||||
mngt_queue = cache_priv->mngt_queue;
|
||||
context = cache_priv->stop_context;
|
||||
|
||||
/*
|
||||
* Flush cache. Flushing may take a long time, so we allow user
|
||||
* to interrupt this operation. Hence we do first flush before
|
||||
@ -3221,6 +3217,10 @@ int cache_mngt_exit_instance(const char *cache_name, size_t name_len, int flush)
|
||||
if (status)
|
||||
goto put;
|
||||
|
||||
cache_priv = ocf_cache_get_priv(cache);
|
||||
mngt_queue = cache_priv->mngt_queue;
|
||||
context = cache_priv->stop_context;
|
||||
|
||||
context->finish_thread = cas_lazy_thread_create(exit_instance_finish,
|
||||
context, "cas_%s_stop", cache_name);
|
||||
if (IS_ERR(context->finish_thread)) {
|
||||
|
Loading…
Reference in New Issue
Block a user