Commit Graph

145 Commits

Author SHA1 Message Date
Michal Rakowski
2ff31a6abf cas_cache: use underscore instead of space in volume type name
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2020-01-16 17:47:57 +01:00
Jan Musiał
51bb7677f1
Merge pull request #268 from mmichal10/fix_mem_leak
Free memory of all allocated threads.
2020-01-16 09:26:26 +01:00
Jan Musiał
11386ab584
Merge pull request #278 from micrakow/report_v20.1
Update reported CAS version to 20.1
2020-01-16 09:25:00 +01:00
Michal Rakowski
4e7653b736 Update reported CAS version to 20.1 2020-01-15 16:12:14 +01:00
Ostrokrzew
bbc03abdf7 Casadm update
Add extended error message in casadm.
Add shortened code mapping for new error code.

Signed-off-by: Ostrokrzew <slawomir.jankowski@intel.com>
Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
2020-01-15 14:30:58 +01:00
Jan Musial
b5f014f689 Fix upgrade errors
Signed-off-by: Jan Musial <jan.musial@intel.com>
2020-01-14 09:53:03 +01:00
Michal Mielewczyk
4ec277433d Free memory of all allocated threads.
This pach fixes memory leak which appeared due to commit d483951ebe.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-01-13 06:38:07 -05:00
Michal Mielewczyk
79631867b8 Remove semicolons after 'if' condition
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-01-07 09:41:16 -05:00
Michal Mielewczyk
36e34b5a69 Don't try to restore cache after stop error.
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>
2020-01-02 18:34:30 -05:00
Michal Mielewczyk
232f13a8a4 Allow to interrupt cache init, load and stop.
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>
2020-01-02 18:34:30 -05:00
Michal Mielewczyk
0b5ed3f00b Allow flush operations to be interrupted.
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>
2020-01-02 18:34:30 -05:00
Michal Mielewczyk
b7f1dd69a9 Allow waiting for metadata flush to be interrupted.
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>
2020-01-02 18:34:30 -05:00
Michal Mielewczyk
de823b15fc Allow cache r&w locks to be interrupted.
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>
2020-01-02 18:34:30 -05:00
Michal Mielewczyk
7af5d296e1 New error code for interrupted waiting.
This commit is part of patch that will allow to interrupt waiting for OCF
operation.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-01-02 18:34:30 -05:00
Michal Mielewczyk
f7d88c4b3f Don't allow core add, remove nor detach interruptions
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>
2020-01-02 18:34:30 -05:00
Michal Mielewczyk
2ac8214379 Don't allow probe interruption.
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>
2020-01-02 18:34:30 -05:00
Michal Mielewczyk
d483951ebe Free thread memory after it is stopped.
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>
2020-01-02 09:22:13 -05:00
Michal Mielewczyk
3eda503095 Additional null check when starting cache instance
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-01-02 09:22:13 -05:00
Michal Mielewczyk
49c87c9527 Fix legacy error messages.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-01-02 09:22:13 -05:00
Daniel Madej
b1bd3578db
Merge pull request #223 from mariuszbarczak/introducing-new-io-class-caching-rule-file-name-prefix
Introducing a new IO class caching rule - file name prefix
2019-12-30 10:57:47 +01:00
Mariusz Barczak
7facb1e926 Introducing a new IO class caching rule - file name prefix
Signed-off-by: Mariusz Barczak <mariusz.barczak@intel.com>
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-12-27 14:08:32 +01:00
Michal Rakowski
33ad073dfd atomic: use proper step_size in sub io allocation
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-12-23 11:11:08 +01:00
Jan Musial
4c9465b3bf Fix removing clean inactive core
When removing core that's inactive, allow it without "--force" option if
that core is clean.

Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-12-11 13:50:22 +01:00
Robert Baldyga
baa621e882
Merge pull request #167 from arutk/fix_block_dev_get_elevator_name_prototype
Make __block_dev_get_elevator_name return const string
2019-11-05 12:35:21 +01:00
Adam Rutkowski
ff207f9b2e Make __block_dev_get_elevator_name return const string
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>
2019-10-28 16:33:38 -04:00
Adam Rutkowski
9b8fdde201 Relax allocations requirements
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>
2019-10-23 16:04:27 -04:00
Adam Rutkowski
f9f00df576 Use vmalloc instead of kmalloc in mem pools
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-10-23 16:04:18 -04:00
Adam Rutkowski
e91e58ef66 Revert "env: implement vmalloc with GFP flags"
This reverts commit c5165838e5.
2019-10-18 19:18:31 -04:00
Michał Mielewczyk
1d25ace1cb
Merge pull request #154 from arutk/module_lock
Acquire module_lock before symbol lookup
2019-10-18 16:36:53 +02:00
Adam Rutkowski
f9b8c2d355 Acquire module_lock before symbol lookup
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-10-18 17:24:21 -04:00
Michał Mielewczyk
bf89577602
Merge pull request #157 from arutk/remove_allocation_from_logger
Replace runtime allocation in logger with static percpu buffer
2019-10-18 16:34:49 +02:00
Adam Rutkowski
dc61d28247 Replace runtime allocation in logger with static percpu buffer
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-10-18 17:44:13 -04:00
Michał Mielewczyk
affe543e3d
Merge pull request #155 from arutk/fix_vfree
Fix cas_vfree
2019-10-18 16:26:00 +02:00
Adam Rutkowski
f7cc3d414c Fix cas_vfree
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>
2019-10-18 17:29:05 -04:00
Adam Rutkowski
c5165838e5 env: implement vmalloc with GFP flags
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-10-18 17:35:29 -04:00
Michal Mielewczyk
fe7da3220d Mark removed core id as free.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-10-01 10:00:08 -04:00
Michal Mielewczyk
296db39ea0 Adapt to new OCF PP param set/get API.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-10-01 06:54:32 -04:00
Michal Rakowski
4cbf555793 OCF update
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-10-01 10:32:03 +02:00
Robert Baldyga
a2d78103f2 wait interruptible in code called from ioctl handler
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-09-26 17:11:20 +02:00
Michal Rakowski
3898c9e52d Add blk-mq.h include to linux_kernel_version.h
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-09-26 16:16:27 +02:00
Adam Rutkowski
186bfbc704 Fix cache reference management in get/set seq cutoff threshold
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>
2019-09-26 14:10:17 -04:00
Michal Mielewczyk
8b0d10952f Don't generate core name when adding core to corepool.
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>
2019-09-25 15:36:02 -04:00
Adam Rutkowski
360a73ae5b
Merge pull request #125 from robertbaldyga/core-param-error-handling
Fix core set param error handling
2019-09-25 20:28:06 +02:00
Robert Baldyga
d5207cb391 Update OCF -> POSIX error mapping
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-09-25 17:22:34 +02:00
Robert Baldyga
a7390aa6fc Return error on invalid core id
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>
2019-09-25 17:22:01 +02:00
Michal Mielewczyk
e96b37ecc2 Confirm cache name before load.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-25 09:44:07 -04:00
Robert Bałdyga
8f45549cc7
Merge pull request #107 from robertbaldyga/cleanup-cas-version
Cleanup cas version
2019-09-19 13:45:17 +02:00
Michal Rakowski
b3dd5ead36
Merge pull request #106 from imjfckm/fix-puts
Remove unneccessary cache_puts
2019-09-19 12:55:34 +02:00
Robert Baldyga
b9177f65c8 Update Open CAS version to 19.09
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-09-19 12:44:42 +02:00
Robert Baldyga
19bc5da2cf Cleanup CAS_VERSION
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-09-19 12:43:34 +02:00