Commit Graph

474 Commits

Author SHA1 Message Date
Gal Hammer
4ed8a59402 configure/bio_max_vecs: adapt to kernel 5.12
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>
2022-03-08 16:06:03 +02:00
Robert Baldyga
759338e742 Remove "metadata_layout" module parameter
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-03-08 08:53:47 +01:00
Robert Baldyga
1f15724b88
Merge pull request #1053 from hammerg/fix_kernel_5.12_v2
Add a support for kernel 5.12
2022-03-08 08:25:58 +01:00
Gal Hammer
4bb435555f configure/bd_part_count: adapt to kernel 5.12
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>
2022-03-07 09:44:35 +01:00
Gal Hammer
fea5e72d8c configure/module_mutex: adapt to kernel 5.12
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>
2022-03-07 09:41:59 +01:00
Piotr Debski
e7a9f29d36 initializing completion twice replaced with reinit
Signed-off-by: Piotr Debski <piotr.debski@intel.com>
2022-02-27 02:50:20 +01:00
Piotr Debski
7b304d9f48 When core exported object name exists activation fails and cache is stopped
Signed-off-by: Piotr Debski <piotr.debski@intel.com>
2022-02-25 23:06:17 +01:00
Jan Musial
9da912e485 Forbid using load with other options in cas_cache
Signed-off-by: Jan Musial <jan.musial@intel.com>
2022-02-10 12:06:37 +01:00
Jan Musial
2ff055d689 Don't generate cache_id's on casadm side and use loaded cache params
Signed-off-by: Jan Musial <jan.musial@intel.com>
2022-02-10 12:06:37 +01:00
Robert Baldyga
7041517bf4
Merge pull request #1040 from robertbaldyga/fix-core-add-bug
Protect core config preparation function against non-existing cache
2022-01-12 12:29:54 +01:00
Robert Baldyga
05e0590fbc Protect core config preparation function against non-existing cache
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>
2022-01-10 20:03:50 +01:00
Robert Baldyga
63bab9584c Redesign failover standby management
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-01-05 16:17:52 +01:00
Robert Baldyga
b0a3c9cd45
Merge pull request #982 from robertbaldyga/remove-redundant-io-get-put
Remove redundant ocf_io_get()/ocf_io_put() from bottom volume
2021-12-27 15:21:32 +01:00
Adam Rutkowski
0f6a024025 Make device parameter obligatory in failover activate
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-12-01 00:58:09 +01:00
Robert Baldyga
990f55d250 Fix error mapping
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-11-26 09:29:37 +01:00
Robert Baldyga
d28881588d Map OCF error codes to errno in io path
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-11-25 17:11:07 +01:00
Robert Baldyga
57a3938872 Improve error mapping code
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-11-25 17:11:07 +01:00
Robert Baldyga
73461fc26d Add missing error mappings
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-11-25 16:27:08 +01:00
Robert Baldyga
6743c02033 Return kernel error codes on I/O path
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-11-22 14:35:24 +01:00
Robert Baldyga
b189a7147e Update OCF - dynamic metadata update in standby mode
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-11-19 17:02:32 +01:00
Rafal Stefanowski
2097f8029b Set promote_on_threshold sequential cutoff flag
Due to linux thread scheduling nature, we prefer to promote streams
as early as we reasonably can. One way to achieve that is to set
promotion count really low, which unfortunately significantly increases
number of accesses to shared structures. The other way is to promote
streams which reach cutoff threshold, as we can reasonably assume that
they are likely be continued after thread is rescheduled to another CPU.

Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
2021-11-09 13:41:49 +01:00
Robert Baldyga
f909b21276 Remove redundant ocf_io_get()/ocf_io_put() from bottom volume
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-11-05 12:49:44 +01:00
Robert Baldyga
5431f83273
Merge pull request #962 from Open-CAS/passive_api
Passive state - API changes
2021-11-03 10:11:08 +01:00
Krzysztof Majzerowicz-Jaszcz
3185564869 Standby state API changes
Don't print statistics for a cache in passive state
Passive cache - casadm set/get cache param disabled in passive state
Obsolete "cache_get_param" function removed
Error in layer_cache_management.c fixed
Flushing cache/core disabled with error for passive mode
Core addition disabled in passive mode
IO class setting disabled for passive mode
Counters reset disabled for passive mode
Ioctl handling changes to reflect OCF API changes

Signed-off-by: Krzysztof Majzerowicz-Jaszcz <krzysztof.majzerowicz-jaszcz@intel.com>
2021-10-29 12:34:33 +02:00
Rafal Stefanowski
acec05060d Fix license
Change license to BSD-3-Clause

Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
2021-10-28 12:46:42 +02:00
Adam Rutkowski
90d8584bd7 failover detach
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-10-08 15:20:52 +02:00
Robert Baldyga
6792c1b455
Merge pull request #930 from robertbaldyga/cache-passive-state
Add cache passive state
2021-09-10 13:09:23 +02:00
Robert Baldyga
f8e39fa104 Introduce activate operation
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-10 08:56:59 +02:00
Robert Baldyga
17aa424319 Introduce cache bind operation
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-10 08:56:54 +02:00
Robert Baldyga
c0110a4d01 Introduce cache exported object
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-09 22:34:56 +02:00
Robert Baldyga
81108f74b7
Merge pull request #927 from jfckm/use-plugging-in-bottom-adapter
Use blk_plug mechanism in bottom block adapter
2021-09-02 11:23:37 +02:00
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
feb7134e34
Merge pull request #924 from jfckm/add_mq_blocking_config
Add config for BLK_MQ_F_BLOCKING flag
2021-08-20 10:21:11 +02:00
Robert Baldyga
a413e676e9
Merge pull request #925 from mmichal10/env-refactor
Env refactor
2021-08-20 10:20:17 +02:00
Jan Musial
6c6bc95b29 Use blk_plug mechanism in bottom block adapter
This is a suboptimal solution to CAS on top of MD RAID1 device. If using
only submit_bio API RAID1 would process all IOs in single thread.
Plugging bypasses this thread and processess IOs in blk_finish_plug
caller context improving performance drastically.

Testing showed no negative impact to other usecases and it's a thing
that Linux does in AIO, so it's vetted and proven to work.

Signed-off-by: Jan Musial <jan.musial@intel.com>
2021-08-18 11:42:37 +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
Jan Musial
ac00bd503a Add config for BLK_MQ_F_BLOCKING flag
Signed-off-by: Jan Musial <jan.musial@intel.com>
2021-08-18 09:04:15 +02:00
Michal Mielewczyk
5e4fcb62be env: refactor rwmutex
All the operations on `count` are performed under the lock thus it doesn't need
to be atomic.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-08-17 15:52:25 +02:00
Michal Mielewczyk
39bab9ad87 env: simplify env_rwsem
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-08-17 15:52:25 +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
2e4c460702 Use cache line size as discard granularity
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-07-15 22:47:08 +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
Robert Baldyga
517d98a6ed Split big IO requests
OCF cannot allocate request map bigger than 4MiB (due to kmalloc
limitations), thus we need to split bigger IOs into series smaller
ones to reduce request map size.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-07-07 18:52:22 +02:00
Robert Baldyga
34dbbc056d Fix exported object deinitialization
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-06-24 14:24:04 +02:00
Kozlowski Mateusz
62f4c61f8e Update mpool API for vol_atomic_dev_bottom
Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
2021-06-23 14:57:21 +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
2d7b94fa21 Remove block_dev_start_bio()
Now submit_bio path has no fallback to request queue, so we can simplify
io accounting.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-06-15 18:59:08 +02:00
Robert Baldyga
62eb6dc3fd Remove unused functions from top volume
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-06-15 18:59:08 +02:00
Robert Baldyga
5e17d0833f Remove unused callbacks from cas_disk ops
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-06-15 18:59:08 +02:00
Robert Baldyga
7f89e59b1a Remove CAS_FLUSH_SUPPORTED
It's defined on every single supported kernel, so there is actually no need
for this define at all.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-06-15 18:59:08 +02:00
Robert Baldyga
b82b338c53 Remove blk request handling path
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-06-15 18:59:08 +02:00
Robert Baldyga
7343cb55fa Handle all io on bio handler
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-06-15 16:52:35 +02:00
Robert Baldyga
fbc3906576 Replace removed kernel API function with new one
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-05-26 23:35:30 +02:00
Slawomir Jankowski
964877ddd6 Typo fix
Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
2021-05-13 17:02:05 +02:00
Slawomir Jankowski
9e7f163216 Cleanup exported object queue
This patch fixes adding core after core addition failure.
The queue wasn't cleaned before and following core addition cannot
re-initialize queue properly.

Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
2021-05-13 17:01:41 +02:00
Robert Baldyga
a226b39c4e
Merge pull request #811 from mmichal10/fix-discard
Fix max discard size
2021-05-10 15:36:37 +02:00
Michal Mielewczyk
0387ba18d7 Fix max discard size
`blk_queue_max_discard_sectors()` accepts 32bit parameter

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-05-07 11:14:46 +02:00
Michal Mielewczyk
0e8758528b Return mempool instead of enum
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-04-22 14:17:39 +02:00
Adam Rutkowski
9c08ed4b87 Set proper multiqueue flags
Setting BLK_MQ_F_STACKING (to indicate stacked device) and
BLK_MQ_F_BLOCKING (to indicate potentially blocking operations
like acquiring mutex or GFP_NOIO allocations).

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-04-16 22:52:18 -05: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
Kozlowski Mateusz
a45f0c854f Fix _blockdev_set_bio_data iteration
The data->size field can be initialized to a lower value than bio->bi_vcnt,
if the bio is split. The bio_for_each_segment then iterates based on the original
indexes and the mismatch eventually causes a BUG_ON.

Fixes #714

Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
2021-04-08 12:28:35 +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
Kozlowski Mateusz
ab0a7e0a44 Add detection of ktime_get_real_ts64 vs getnstimeofday
Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
2021-03-26 13:46:09 +01:00
Slawomir Jankowski
eef4e49904 Use time since epoch instead of jiffies
If time is counted in jiffies, machine reboot brokes `dirty for`
statistic for caches loaded at boot. The counter overflows and
`dirty for` shows some huge values.
Cast ticks to unsigned long.
Add necessary header.
Move `env_msleep` to `TIME` subgroup of header.
Move `env_time_after` below time converting functions.

Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
2021-03-26 13:46:09 +01:00
Kozlowski Mateusz
74ca3daa37 Classifier alignment
Move lock to a different cacheline to avoid trashing

Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
2021-03-22 08:26:55 +01:00
Kozlowski Mateusz
da9a6204d3 General structure packing
Pack often used structures, so that less memory/cachelines are used

Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
2021-03-22 08:26:55 +01:00
Kozlowski Mateusz
c751974ae0 Allocator structures cacheline alignment
Align atomic fields to a different cacheline, so no false sharing between
CPUs occur.

Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
2021-03-22 08:26:55 +01:00
Robert Baldyga
880cfadde9 Makefile: improve uninstall error handling
Introduce helper functions to handle uninstall errors gracefully.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-03-19 15:37:55 +01:00
Michal Mielewczyk
f1c34340e0 Change REMOVE_INACTIVE ioctl type
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-03-12 09:21:49 +01: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
696a2e175c Add KCAS_IOCTL_REMOVE_INACTIVE request to cas_cache module
Add IOCTL code and struct for above request.

Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
2021-03-10 14:39:07 +01:00
Slawomir Jankowski
760b60628c Add KCAS_ERR_CORE_IN_ACTIVE_STATE error code.
New error code will allow to properly handle issues caused by wrong
usage of `remove inactive core` command.
It will also allow to print meaningful error messages.

Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
2021-03-10 14:39:07 +01:00
Slawomir Jankowski
2bf6e42dea Print separate messages for different "remove core" return codes
Change extended error message for `KCAS_ERR_REMOVED_DIRTY`.
Print informative messages when `remove core` command fails.
Make separate error messages for detaching.
Update help printouts.
Update documentation comments.

Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
2021-03-10 14:26:09 +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
Robert Baldyga
9bc827a4f2
Merge pull request #721 from mmichal10/update-ocf
Update ocf
2021-03-07 20:34:55 +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
Jan Musial
f1a19363e5 Include mpool in env and use new allocator API
Signed-off-by: Jan Musial <jan.musial@intel.com>
2021-03-05 14:02:08 +01:00
Jan Musial
bcc55f4f3c Extend allocator API
Create function for directly changing the size of rpool backing created
allocator.

Signed-off-by: Jan Musial <jan.musial@intel.com>
2021-03-03 11:17:22 +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
ca3e1a5984 Revert "modules: use si_mem_available() when possible"
This method produced too optimistic free memory value, which in result
led to oom killer activation. This patch restores more conservative
free memory calculation method.

This reverts commit 1e9b7a4262.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-01-14 15:16:09 +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
6bd2681134
Merge pull request #611 from robertbaldyga/shorten-cleaner-thead-name
Shorten cleaner thread name
2020-12-31 21:11:10 +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
ea581953e1 Shorten cleaner thread name
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-12-30 18:12:21 +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
2753bad018
Merge pull request #568 from mmichal10/occupancy-per-ioclass
Occupancy per ioclass
2020-12-23 14:36:02 +01:00
Michal Mielewczyk
36cf52940b env: print format for 64 bits signed int
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-12-23 07:23:02 -05:00
Michal Mielewczyk
3c678e57d7 classifier: fix string comparison
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-12-23 07:23:02 -05:00
Robert Baldyga
7e40570bbd Remove #ifdef for unsupported kernel version
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-12-22 11:33:38 +01:00
Robert Baldyga
bcd6f4831c Update atomic mode support check
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-12-22 11:33:38 +01:00
Robert Baldyga
1810010093 Use default kernel export mechanism when symbol lookup is not available
Since kernel 5.7 kallsyms_on_each_symbol() is not available.
NOTE: This affects ability to perform upgrade in flight on kernels 5.7+.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-12-22 11:33:38 +01:00
Robert Baldyga
0596597f61 Replace ioctl_by_bdev() with vfs_ioctl()
Since kernel 5.8 ioctl_by_bdev() is not available.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-12-22 11:33:38 +01:00
Robert Baldyga
c596c66063 configure: Add wrappers for default make request function
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-12-22 11:33:38 +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
Robert Baldyga
d9ea8d3e32 configure: Add blk_queue_make_request() wrapper
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-12-22 11:33:38 +01:00
Robert Baldyga
ca7f809965 configure: Add __vmalloc() wrapper
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-12-22 11:33:38 +01:00
Robert Baldyga
bbd0cb57a5 configure: Update generic_acct wrapper to kernel 5.8
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-12-22 11:33:38 +01:00
Robert Baldyga
933c98b00a
Merge pull request #538 from arutk/flush
Remove potentially_dirty counter from bottom volume
2020-11-30 10:10:50 +01:00
Robert Baldyga
fc5b7f6c53 Add missing header
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-11-18 22:37:05 +01:00
Robert Baldyga
539e64e2c9
Merge pull request #566 from robertbaldyga/deb-dkms
Introduce DKMS support for DEB packages
2020-11-05 14:01:32 +01:00
Robert Baldyga
3060aaf95f Introduce DKMS support for DEB packages
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-11-04 11:47:34 +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
Adam Rutkowski
7905ca79fa Remove potentially_dirty counter from bottom volume
This counter is not accurate (missing required memory barrier
to avoid unwanted behavior due to processor optimizations)
and performance gain is not clear - generally global
atomic variables are something we would like to avoid
going forward.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2020-09-29 15:21:11 +02:00
Michal Mielewczyk
8b64206570 configure: add CAS_BLK_BIDI_RQ() macro
Since commit 8b3238cabd50e27 in linux kernel removed blk_bidi_rq() marco, it
has to be wrapped in CAS `configure` script

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-08-25 08:46:24 -04:00
Michal Rakowski
1cd1db2b45 Fully remove format nvme command
Since there is no kernel-kernel api available to communicate
with nvme driver it is more convenient to use some nvme-dedicated
software (e.g. nvme-cli) to manage nvme devices.
It is even not possible to format nvme device with CAS using current
implementation on newest kernels.

Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-08-11 06:10:31 -04:00
Robert Baldyga
b8cfee1883
Merge pull request #435 from rafalste/update_versioning
Version unifying
2020-07-27 18:34:46 +02:00
Robert Baldyga
4fb2600721
Merge pull request #457 from robertbaldyga/better-cas-thread-names
Improve CAS thread names
2020-07-08 16:21:12 +02: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
8363b67993 cas_disk: handle allocation error properly
In case of error `blk_mq_init_queue()` does not return NULL, but
`ERR_PTR(error_code)` instead.

`IS_ERR_OR_NULL()` should be used to check if `blk_mq_init_queue()` actually
failed.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-07-07 07:43:52 -04:00
Robert Baldyga
83410b2abf Improve CAS thread names
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-07-03 15:05:00 +02: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
Rafal Stefanowski
afa0c1b53f Modify version check flow
Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
2020-06-10 15:08:37 +02:00
Michal Mielewczyk
b0f8a67071 Core id based io classification
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-05-21 08:44:20 -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
Robert Baldyga
382247b5e7
Merge pull request #407 from imjfckm/schedule-in-sort
Add conditional reschedules to env_sort
2020-04-30 15:35:34 +02:00
Jan Musial
d25b059e2c Add conditional reschedules to env_sort
Sorting can take a long time with big cache sizes and a lot of dirty
data. Make sure we reschedule frome time to time to avoid lockups.

Signed-off-by: Jan Musial <jan.musial@intel.com>
2020-04-29 11:34:40 +02:00
Michal Rakowski
1e9b7a4262 modules: use si_mem_available() when possible
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2020-04-29 11:05:41 +02:00
Robert Baldyga
f127d7c825 Update version to v20.6 (WIP version)
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-04-22 16:13:00 +02:00
Robert Baldyga
162f0a477a
Merge pull request #382 from robertbaldyga/update-ocf-flush-deadlock
Update OCF and handle new error code
2020-04-06 10:05:32 +02:00
Robert Baldyga
d694228263 Update OCF and handle new error code
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-04-06 09:03:14 +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
603308f689
Merge pull request #374 from mmichal10/memory-find
Stop cache threads synchronously
2020-03-31 15:30:15 +02:00
Michal Mielewczyk
664c974e03 Revert "Free thread memory after it is stopped."
This reverts commit d483951ebe.
2020-03-31 08:23:57 -04:00
Michal Mielewczyk
1b3424a485 Revert "Free memory of all allocated threads."
This reverts commit 4ec277433d.
2020-03-31 06:46:27 -04:00
Michal Mielewczyk
758c5aa895 Don't hold reference to module in thread
Since stopping threads have to be done synchronusly, there is no need to keep
reference to cas_cache module in each thread.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-03-31 06:41:11 -04:00
Robert Baldyga
299d1211ef
Merge pull request #372 from mmichal10/memory-find
Alloc rpool with strict memory requirements
2020-03-30 13:30:52 +02:00
Adam Rutkowski
82137c9bc1 Improve _env_allocator_item fields alignment
This change assures that data array is always optimally aligned.
Additionally item boolean flags are put into the same uint32
as cpu number in order to save space for future additions.

This change fixes ~50% performance degradation introduced by
commit d822a1d1.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2020-03-30 00:39:26 +02: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
8c57dc51c0 Alloc rpool with strict memory requirements
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-03-25 19:25:26 -04: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
Robert Baldyga
de296dd89f
Merge pull request #367 from mmichal10/async-stop-compl
Create finalize thread during stop
2020-03-26 14:16:29 +01:00
Robert Baldyga
af6d3e9d06
Merge pull request #368 from arutk/rpool_debug
Runtime checks for allocator rpool consistency
2020-03-25 15:09:20 +01:00
Robert Baldyga
5b37183e41
Merge pull request #344 from rafalste/add_package_generator
Add package generator script
2020-03-25 12:40:29 +01: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
Adam Rutkowski
d822a1d12e Runtime checks for allocator rpool consistency
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2020-03-24 01:58:11 +01:00
Robert Baldyga
ef94a0df22
Merge pull request #362 from mmichal10/fix-core-removing
Fix core removing
2020-03-23 14:41:17 +01:00
Robert Baldyga
8b1254dfea
Merge pull request #355 from mmichal10/async-stop-compl
Async stop compl
2020-03-23 13:00:50 +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
Michal Mielewczyk
91c8c02860 Simplify functions managing core ids
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-03-20 10:39:17 -04:00
Michal Mielewczyk
5ca9287b53 Refactor core removing function
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-03-20 10:39:17 -04:00
Rafal Stefanowski
7335b321ea Add package generator script
- add a 'pckgen' script to generate various OpenCAS packages like
release archives (tar, zip), RPMs (source and binary) as well as to
create version file with metadata
- add a SPEC file for RPM creation
- add Makefile targets to use 'pckgen' script through 'make <package>'

'pckgen' script has a bunch of features for package generation.
Read './pckgen --help' for more information on usage scenarios.

Script is also prepared to easily add new packages creation in the future.

Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
2020-03-20 03:16:56 +01:00
Michal Mielewczyk
2ef9090d87 Fix metadata updater thread prefix
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-03-17 18:04:49 -04:00
Michal Mielewczyk
917577480f Remove running field from cas thread info
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-03-07 16:10:36 -05:00
Michal Mielewczyk
e39eecab49 Don't try to stop non running thread
If _cas_create_thread() thread failed, queue should be stopped by ocf. One of steps
done during queue stop is stopping kernel thread.

To avoid stopping thread which is not running, additional check was added in
_cas_stop_thread().

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-03-07 15:22:30 -05:00
Michal Mielewczyk
3eab28cf44 Add missing module_put() in casse of alloc error
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-03-07 08:47:24 -05:00
Jan Musial
19c334c4cf Move classifier init after cache device attach completion
Right now the classifier is instantiated before device is attached.
This way if we have any IO-classes present on cache device the
classifier will have no knowledge of them and fail to classify IO
correctly.

After moving the classifier init to cache finalization routine we have
all the information needed to initialize properly both in new instance
start path and in load path.

Signed-off-by: Jan Musial <jan.musial@intel.com>
2020-02-25 14:00:07 +01:00
Adam Rutkowski
e1a7c7f7e8 env: implement vmalloc with GFP flags
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2020-02-14 14:30:12 +01:00
Rafal Stefanowski
0d256b675d Makefile changes for building RPM
Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
2020-02-11 14:47:32 +01:00
Adam Rutkowski
aec95d70c9 Add ENV_BUILD_BUG_ON macro to kernel environment
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2020-02-10 16:25:35 -05:00
Michal Mielewczyk
a0937758b7 Handle flush core interruption.
When flushing core, acquiring write lock is not necessary, so it was replaced
with read lock wherever possible.

If flushing operation is interrupted by signal, not only waiting for it to be
finished is interrupted but also OCF flush operation is stopped.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-01-28 15:41:31 -05:00
Michal Mielewczyk
3e033df9c6 Handle flushing cache interruption.
When flushing cache, acquiring write lock is not necessary, so it was replaced
with read lock wherever possible.

If flushing operation is interrupted by signal, not only waiting for it to be
finished is interrupted but also OCF flush operation is stopped.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-01-28 15:41:31 -05:00
Michal Mielewczyk
eef3667435 classifier: use secure versions of strcmp and strcpy
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-01-25 04:54:56 -05:00
Michal Rakowski
fe2a8706e9 prepare_cache_cfg: change bug_on to returning err instead
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2020-01-24 15:14:49 +01:00
Michal Rakowski
1b46117908 io_class string ctr: use strnlen
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2020-01-24 15:11:33 +01:00
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