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>
After marking thread as ready to stop, CAS was waiting this for thread to exit
out of main execution loop (in _cas_io_queue_thread()). In case of management
queue it lead to deadlock because both stoping queue and main execution loop was
performed in the same execution context.
Since freeing memory is the only operation after stopping thread, it can be
moved just after the main thread loop. After this little reordering,
synchronising between _cas_stop_thread() and _cas_io_queue_thread() in no longer
needed, and no deadlock will occur.
This change is needed to put management qeueue from completion context. Without
this cachnge, there will be no possiblitiy to stop cache from completion context
and to make rollback.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
Returning non-const char* doesn't have any benefits since
the only caller casts the output pointer to const char *.
This change fixes compilation on 5.3 kernel.
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
CAS does not need atomic alocations virtually anywhere. GFP_NOIO
should be sufficient in IO path. When allocation buffers during
module initialization use GFP_KERNEL.
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
1. cas_vfree implementation is now properly selected based on kernel version
2. cas_vfree semantics now accepts NULL pionter as a valid input
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@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>
When core frome corepool is added to cache, it's old name is loaded and cores
in corepool cannot be referenced by name anyway so new name is not needed.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
Instead of silently allowing for any core_id in order to set
core parameter for all cores in cache, check explicitly for
special value (OCF_CORE_ID_INVALID) which means that no core
has been selected.
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
Check if provided log level isn't greater than number of available log levels
Prevoius check was comparing log level to size of array with avaiable log levels
(in bytes).
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>