In case of initial flush error stop is aborted. In case
of failure during the second flush, appropriate error
message is presetned to the user.
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
Don't remove inactive core if it has dirt cache lines assigned unless `force`
flag is specified.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
Create module-side handling of inactive core removal.
Extract core functionality of core removal that applies to inactive core
and copy it to `cache_mngt_remove_inactive_core` function.
Return proper error if core is active.
Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
FLush only active core during core removal.
During core removal with `casadm -R` there's a flush triggered.
This flush shall be skipped for inactive cores.
Change return code when `casadm -R` is called with `force` flag.
There was no info about dirty data when core was removed without flush.
Do not destroy exported object while core is inactive.
Perform detach only on active cores.
Skip removing inactive core with command for active cores.
Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
Kernel adapter now returns is_cache_device=1 and newly added
metadata_compatible=0 in case of metadata detected with
differing version (instead of is_cache_device = 0).
This allows zero-superblock command to recognize old
cache instance and clear it.
casadm --script --check-cache-device still returns 'Is cache'='no'
in this case, as this layer only cares about metadata in current
version to be able to detect dirty datas tatus.
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
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>