Commit Graph

53 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Michal Rakowski
b3dd5ead36
Merge pull request #106 from imjfckm/fix-puts
Remove unneccessary cache_puts
2019-09-19 12:55:34 +02:00
Jan Musial
9598fa76f1 Expose PP settings in IOCTL iface
Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-09-19 08:38:35 +02:00
Jan Musial
0810df2a0e Add OCL wrappers for promotion policy management 2019-09-18 13:58:55 +02:00
Jan Musial
429302adfc Remove unneccessary cache_puts
Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-09-18 13:02:25 +02:00
Michal Mielewczyk
5f81173844 Leave space for terminating \0 in cache name initialization.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-18 05:00:29 -04:00
Michal Mielewczyk
39a3d04c93 Handle separate functons for retrieving core stats and info.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-16 09:24:14 -04:00
Michal Mielewczyk
1abb1e7c72 Adapt ioclasses stats command to ocf stats builder.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-16 09:24:14 -04:00
Michal Mielewczyk
4726bedb50 New ioctl for retriveing ocf stats.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-16 06:30:13 -04:00
Michal Mielewczyk
76acefd831 After loading cache mark used core ids.
Since OCF doesn't use core and cache ids anymore adapter has to track occupied
ids on its own. After loading cache, ids of all loaded cores should be marked as
occupied, otherwise adding new core without explicit specifying core id will
fail.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-11 02:08:28 -04:00
Michal Mielewczyk
7ecd537170 Fix setting core params.
If core id wasn't specified, function was returning error insted of setting
given param for all cores.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-04 07:48:04 -04:00
Michal Mielewczyk
9e05950845 Reset particular core stats only if core was specified by user.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-08-20 07:20:02 -04:00
Michal Mielewczyk
341222e3d7 Treat '16384' as valid cache id.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-08-20 03:42:05 -04:00
Michal Mielewczyk
56cbc6595b Pass name for newly initialized cache in array instead of pointer.
Unitl now pointer to local variable was passed to OCF and it's content could be
overwriten after leaving function responsible for preparing cache config.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-08-20 03:42:05 -04:00
Robert Baldyga
f038223979 Use name based OCF management API
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-08-16 14:08:34 +02:00
Michal Rakowski
eee7a0e220 Fix exported object cleanup in case of cache stop failure
In case of error during cache stop exported object is not being restored after destroying.
This may result in bug in case of calling stop once more.
This commit fixes this issue - exported objects are restored.

Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-07-17 15:09:39 +02:00
Michal Rakowski
47a150644c Doxygen fixup
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-07-17 09:43:43 +02:00
Michal Mielewczyk
c1b5ccbc75 Initialize structures with 0.
If 'open_cores' flag is not explicite set, cores migth not be added on cache
load.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-07-04 03:06:24 -04:00
Jan Musial
506ff687f7 Fix get_core_info trying to access already freed UUID
Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-06-28 13:15:20 +02:00
Michal Rakowski
3ca9a14bb2 Use lookup_bdev generated macro instead of direct call
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-06-28 09:36:11 +02:00
Adam Rutkowski
f0b59c58d9
Merge pull request #53 from mmichal10/validate-core-config
Validate core config
2019-06-27 05:54:49 -04:00
Jan Musial
2964b56615 Fix leaking mngt_queue on load failure
Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-06-27 10:54:37 +02:00
Michal Mielewczyk
db534a70b6 Check if given core device exists.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-06-26 12:37:53 -04:00
Michal Rakowski
a119a6ac2a Added check for dirty cache/core during cache stop/core removal 2019-06-26 09:32:26 +02:00
Michal Mielewczyk
0cb219d178 Fix old metadata detection.
Due the changes in ocf error codes adapter misinterpreted information about no
preexisting metadata.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-06-13 07:55:12 -04:00
Michal Mielewczyk
0208375202 Unified management functions prefix
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-06-06 09:46:40 -04:00
Robert Baldyga
23e330a21f Adapt to new cache lock API
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-06-04 15:24:55 +02:00
Michal Mielewczyk
1e5355eba1 Extending 'configure' script
Functions and macros dependent on different kernel versions are now generated
before compilation basing on current kernel capabilities instead of hardcoding
them for specific kernels.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-05-30 06:29:07 -04:00
Robert Baldyga
077956f9a9 Pass cache_id to cache_mng_add_core_to_cache()
struct ocf_mngt_core_config no longer contains this information,
so we need to pass it as separate argument.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-05-24 18:14:17 +02:00
Robert Baldyga
0411f2d42f Handle non-interruptible flush
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-05-08 12:48:21 +02:00
Michal Mielewczyk
f62c53862d Add asserts in case of detached cache.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-04-19 03:59:43 -04:00
Michał Mielewczyk
e2c901de6d
Merge pull request #8 from arutk/fix-stop-error-handling
Abort cache deinit in case of ocf stop fatal error
2019-04-12 13:40:36 +02:00
Adam Rutkowski
cfaf0d279f Abort cache deinit in case of ocf stop fatal error
We should only proceed with deinitialization in case of cache
write error, not just any error.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-04-10 14:36:07 -04:00
Michal Mielewczyk
4655b397a0 Return appropiriate error code when adding core failed.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-04-10 05:09:07 -04:00