Ignore the interruption of the stop operation - will finish asynchronously.
Remove redundant `ocf_queue_put`.
Move creating the `finish_thread` during the cache stop
from the `_cache_mngt_cache_stop_sync` to the `cache_mngt_exit_instance`
and give it a proper handling.
Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
To avoid logging the same message each time _cache_mngt_create_exported_object()
is called, print error message within it.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
To avoid logging the same message each time block_dev_activate_exported_object()
is called, print error message within it.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
If cache is restored after upgrade, NULL is passed instead of
`struct kcas_start_cache`. This leads to null pointer dereference.
To prevent null pointer dereference, `struct kcas_start_cache` is tested before
each use
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
If cache is initialized successfully, `struct _cache_mngt_attach_context` might
be freed in `cache_mngt_init_instance()`. In such case pointer to rollback
thread can't be accessed and thread can't be stopped.
To prevent such scenario pointer should be kept in separate variable.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
Purge invalidates all cache lines which belongs to given core. It is very
usefull feature for tests.
Calling purge is possbile with casadm `--script` swtich.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
Purge invalidates all cache lines. It is very usefull feature for tests.
Calling purge is possbile with casadm `--script` swtich.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
To prevent cache being stopped before async start finialize has finished, stop
routine have to check if worker responsible for finalizing is not running
anymore.
To create link between start finalize and stop functions, work_struct had to be
moved from attach_context to cache_priv.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
Read lock allows to retrieve informations about flushing progress and printing
progress bar during changing cache mode.
Flushing dirty data during changing cache mode is done twice - first flush might
be interrupted by user and the second one, called with write lock acquired, is
uninterruptable.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
To make cache stop as simple as possibe and to reduce number of errors, stop
context should be allocated during cache initialize.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
To prevent removing cas_cache module when not all thread were stopped yet, each
of them should keep reference.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
To enable stopping management queue from completion context, last queue_put()
have to be called from separate thread.
After cache is fully deinitialized, thread calls module_put_and_exit() to
prevent scenario when code is still executed, but there are no references to
module.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
Right now the classifier is instantiated before device is attached.
This way if we have any IO-classes present on cache device the
classifier will have no knowledge of them and fail to classify IO
correctly.
After moving the classifier init to cache finalization routine we have
all the information needed to initialize properly both in new instance
start path and in load path.
Signed-off-by: Jan Musial <jan.musial@intel.com>
When flushing core, acquiring write lock is not necessary, so it was replaced
with read lock wherever possible.
If flushing operation is interrupted by signal, not only waiting for it to be
finished is interrupted but also OCF flush operation is stopped.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
When flushing cache, acquiring write lock is not necessary, so it was replaced
with read lock wherever possible.
If flushing operation is interrupted by signal, not only waiting for it to be
finished is interrupted but also OCF flush operation is stopped.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
In current OCF cache stop implemetation no error should occur, so there is no
need to handle it in adapter.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
When device used as cache had a big size, it took a lot of time to initialize.
If user would interrupt waiting, asyc OCF init procedure would continue, but
after finish, there was nobody to perfrom kernel part of start nor error
handling.
Now error handling and kernel part of start procedure are moved to completion.
If user will interrupt waiting at any point, newly started cache instance will
be stopped.
Since cache init and load vary only with check for old metadata and initializing
exported objects, they are now merged into one function.
Async cache stop is part of this commit because it was needed for rollback path.
Load, init and stop have common context, because in case of non interrupted
attach CAS needs to wait for rollback to be completed. Common context makes
passing `struct completion` easier between load, init and stop.
This commit is part of patch that will allow to interrupt waiting for OCF
operations.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
When context was allocated on the stack and waiting for completion was
interrupted, completion function would attempt to save flush result in
memory which might in use by other process. This would cause a system crash.
To prevent such scenario, context is allocated dynamiclly and extended with
reference counter. In case of interrupt, completion function doesn't have to
save result in context, it can simply free it's memory.
This commit also enables possibility to interrupt regular flush properly, by
seding SIGING to casadm.
This commit is part of patch that will allow to interrupt waiting for OCF
operations.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
When context was allocated on the stack and waiting for completion was
interrupted, completion function would attempt to save flush result in
memory which might in use by other process. This would cause a system crash.
To prevent such scenario, context is allocated dynamiclly and extended with
reference counter. In case of interrupt, completion function doesn't have to
save result in context, it can simply free it's memory.
This commit is part of patch that will allow to interrupt waiting for OCF
operations.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
When context was allocated on the stack and waiting for completion was
interrupted, completion function would attempt to save lock/unlock result in
memory which might in use by other process. This would cause a system crash.
To prevent such scenario, context is allocated dynamiclly and extended with
reference counter. In case of interrupt, completion function doesn't have to
save result in context, it can simply free it's memory.
This commit is part of patch that will allow to interrupt waiting for OCF
operations.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
They are usually not time comsuming operations, so risk of hung task is low.
So it's easier to temporarily disable interrupts instead of properly handle
async completion.
This commit is part of patch that will handle interrupt of waiting for OCF
operations.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
Usually metadata probe is non time consuming. To avoid dealing with
synchronization problems, noninterruptible wait is performed.
This commit is part of patch that will handle interrupt of waiting for OCF
operations.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
ocf_core_get_cache does not increment cache reference count, so
it shouldn't be paired with cache_put
Fixes#117
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>