Commit Graph

113 Commits

Author SHA1 Message Date
Robert Baldyga
1dd8f12242 Rework exported object management functions
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-08-25 15:38:22 +02:00
Robert Baldyga
1064cecbb9
Merge pull request #921 from mmichal10/remove-atomics
Remove remains of atomic writes support
2021-08-18 09:19:53 +02:00
Michal Mielewczyk
c68de77799 Remove remains of atomic writes support
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-08-16 16:01:21 +02:00
Robert Baldyga
3983cea2b5 Fix cache_priv deallocation
Since cache_priv is allocated with vmalloc() it should be deallocated
with vfree().

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-08-16 05:16:15 +02:00
Robert Baldyga
c968285d9f Remove upgrade-in-flight feature
Due to changes in Linux kernel this feature is not working anymore.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-08-11 20:33:16 +02:00
Michal Mielewczyk
a6d3c70b1d Async API for switching cleaning policy
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-07-27 16:15:09 +02:00
Robert Baldyga
2a35bd09be Introduce lazy helper thread abstraction to avoid hung task
Some helper threads are created at the very beginning of cache start/stop
operations, but they are used only after OCF start/stop finishes, which
may take significant amount of time. Kernel by default creates threads
that wait for the first wake up in uninterruptible state, which may trigger
hung task warning if the first wake up is called more than 120 seconds
after thread creation. To mitigate this problem we create lazy thread
abstraction that waits for a wake up in interruptible state.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-07-13 10:07:25 +02:00
Adam Rutkowski
7aa883dbd3 OCF update (removed configurable eviction policy)
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-21 22:56:51 +02:00
Kozlowski Mateusz
647124895f Update OCF
Remove metadata updater
Update mpool API

Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
2021-06-21 21:57:10 +02:00
Robert Baldyga
e5e0697da4 Add support for kernel 5.11
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-06-15 18:59:08 +02:00
Robert Baldyga
c46c638e2e
Merge pull request #802 from arutk/stop_error_handling
Properly handle flush error in cache stop
2021-04-15 18:11:47 +02:00
Adam Rutkowski
da0dda2dbd Properly handle flush error in cache stop
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>
2021-04-15 18:11:23 -05:00
Michal Mielewczyk
4e680bb50a Reorganize remove-inacitve command
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>
2021-04-12 13:48:28 +02:00
Michal Mielewczyk
083d6fe93e Clean-up 'remove-core' command
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-04-09 19:57:07 +02:00
Adam Rutkowski
048f25379b Check dirty status in case of metadata mismatch
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-04-06 15:37:44 -05:00
Michal Mielewczyk
12db6b4443 Remove redundant cache being stopped check
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-03-12 09:20:19 +01:00
Slawomir Jankowski
461a4f2d96 Introduce "remove inactive core" to cas_cache module
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>
2021-03-10 14:39:07 +01:00
Slawomir Jankowski
f955ce890c Remove inactive core handling from "remove core"
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>
2021-03-10 14:26:09 +01:00
Michal Mielewczyk
35602acb8f Prohibit locking cache while its is being stopped
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-03-09 10:46:47 +01:00
Robert Baldyga
e6710e0016 cas_cache: Add promotion count parameter
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-03-07 20:36:57 +01:00
Michal Mielewczyk
099eeca864 Ioclass min_size removed from public ocf api
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-03-05 16:09:37 +01:00
Adam Rutkowski
68b68db9c0 Zero metadata if on-disk version differs from current
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>
2021-01-21 14:47:54 -06:00
Rafal Stefanowski
43f43068ad Update copyright statements (2021)
Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
2021-01-21 13:15:38 +01:00
Michal Mielewczyk
4d61ded26d Fix use after free bug
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-01-20 02:28:19 -05:00
Slawomir Jankowski
a057a0082f Handle cache stopping interruption
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>
2021-01-19 16:25:11 +01:00
Robert Baldyga
02c3910677 Handle error in ocf_metadata_probe() complete callback properly
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-01-13 15:20:54 +01:00
Robert Baldyga
42c3f3ed8c
Merge pull request #613 from robertbaldyga/start-finalize-sync
Handle cache start finalize synchronously
2020-12-31 21:11:24 +01:00
Robert Baldyga
238b11846b Handle cache start finalize synchronously
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-12-31 19:49:03 +01:00
Robert Baldyga
f87e6970a5 Fix listing caches
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-12-30 17:58:16 +01:00
Robert Baldyga
48c3598ef5 configure: Add bdev_disk_changed() wrapper
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-12-22 11:33:38 +01:00
Jan Musial
b217e406be Perform volume test only for atomic device
Signed-off-by: Jan Musial <jan.musial@intel.com>
2020-11-02 11:39:37 +01:00
Michal Mielewczyk
017c4261b0 cas_cache: log failed creating exported object
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>
2020-07-07 08:28:53 -04:00
Michal Mielewczyk
296cb0ef86 cas_cache: log failed activating exported object
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>
2020-07-07 08:28:53 -04:00
Michal Mielewczyk
c71b5fcbd3 Access attach command conditionaly
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>
2020-06-16 04:20:51 -04:00
Michal Mielewczyk
975ec6f32a Keep pointer to rollback thread in start_finalize
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>
2020-06-16 04:20:51 -04:00
Robert Baldyga
1e25420f86
Merge pull request #404 from rafalste/copyright_update
Update copyright statements
2020-05-19 11:25:11 +02:00
Michal Mielewczyk
3b62e40a2e Purge core command
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>
2020-05-12 11:32:01 -04:00
Michal Mielewczyk
d24288a9b1 Purge cache command
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>
2020-05-12 11:32:01 -04:00
Rafal Stefanowski
44b4020cc1 Update copyright statements
Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
2020-05-04 16:47:38 +02:00
Michal Mielewczyk
e1b8ddbc40 Pass remove core result to cli
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-04-01 22:30:43 -04:00
Robert Baldyga
6bb4dde213
Merge pull request #369 from mmichal10/async-stop-compl
Before stop wait for start to be finished
2020-03-27 13:59:18 +01:00
Michal Mielewczyk
3edaf30a73 Before stop wait for start to be finished
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>
2020-03-25 06:24:23 -04:00
Michal Mielewczyk
33223bacb9 Fix flush sync wrappers
Call completion function in case of allocation error

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-03-25 01:52:04 -04:00
Michal Mielewczyk
17d5c8599d Use wrapper function to flush cache during stop
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-03-25 01:52:04 -04:00
Michal Mielewczyk
dca9769298 Acquire read lock for flushing cache
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>
2020-03-25 01:52:04 -04:00
Michal Mielewczyk
2fffd789c0 Create finalize thread during stop
Creating finalize thread on cache start causes soft lookups during whole
instance lifetime

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-03-24 07:45:33 -04:00
Robert Baldyga
ef94a0df22
Merge pull request #362 from mmichal10/fix-core-removing
Fix core removing
2020-03-23 14:41:17 +01:00
Michal Mielewczyk
9e692435f6 Allocate stop context on during start
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>
2020-03-23 03:28:26 -04:00
Michal Mielewczyk
f93019165f Hold reference to module for each thread
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>
2020-03-20 11:17:00 -04:00
Michal Mielewczyk
55d53867cc Complete cache stop from kthread
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>
2020-03-20 11:17:00 -04:00