Null pointer dereference occurs when terminating cache is standby detached state.
This fixes this problem.
Fixes#1235
Signed-off-by: Krzysztof Majzerowicz-Jaszcz <krzysztof.majzerowicz-jaszcz@intel.com>
_cas_stop_thread() function synchronizes with cleaner thread, so after
that we can be sure that there are no more ongoing cleaning requests.
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
Changing cache mode to the same mode is a special case that in OCL is
handled on the kernel level, without calling an OCF API. In result it
seemed to succeed even in standby mode, which should return an error.
Explicitly check for standby to return an appropriate error code.
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
Instead of stopping passive instance in case of every possible error, allow it
to remain in standby mode if the error was handleable
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
Cache priv is being allocated on starting cache instance and is freed only when
stopping cache. This cachnge allows to properly handle rollback if activate has
failed. Without setting this flag managment queue is not being stopped despite
its cache doesn't exist.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
When dir is ignored, and 0 is passed instead, each flush request will
appear as READ request, which is not supported by some block device
drivers.
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
One of the steps of discarding data in cache is invalidating OCF metadata.
If a cache line which is supposed to be discarded is dirty, invalidating
it will require flushing metadata. Unfortunately, OCF allocates flushing
requests with the exactly the same flags as the original IO (in this case
discard flag is set) so the page on the disk is discarded instead of being
flushed. In case of power failure occurring before the metadata is flushed
to the disk, the data may be corrupted even if recovery will succeed.
Disabling propagation of original I/O flags for discard requests solves
this problem.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
The bio_alloc_bioset() function now BUG() if trying to allocate a bio
with more than BIO_MAX_VECS vectors.
A no-limit value (-1) is defined in order not to change old kernels'
behaviour.
Signed-off-by: Gal Hammer <gal.hammer@huawei.com>
Signed-off-by: Shai Fultheim <shai.fultheim@huawei.com>
Moved cas_blk_get_part_count function to configure section after the
the disk's partitions table was changed to xarray.
Signed-off-by: Gal Hammer <gal.hammer@huawei.com>
Signed-off-by: Shai Fultheim <shai.fultheim@huawei.com>
The module_mutex is internal to the module loader since kernel
commit 922f2a7c.
Signed-off-by: Gal Hammer <gal.hammer@huawei.com>
Signed-off-by: Shai Fultheim <shai.fultheim@huawei.com>
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
It is legal to call KCAS_IOCTL_INSERT_CORE against non-existing cache
(in try_add mode), however in that case core_id has to be provded.
Return error code in case when given cache id does not exist and core_id
is set to OCF_CORE_MAX.
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>