Commit Graph

76 Commits

Author SHA1 Message Date
Gershon Geva
2096e34489 Pass user's params when opening a core volume
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-09-04 20:29:41 +02:00
Michal Mielewczyk
1c7de189e2 Get rid of non-OCF error codes
Let's put an end to random crashes and vague error messages in pyocf!

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-08-29 08:27:51 +02:00
Michal Mielewczyk
83ec255458 Disable changing cache params for detached cache
Majority of management operations should be blocked for detached cache,
although adding and removing cores should be possible.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-07-10 16:19:37 +02:00
Michal Mielewczyk
3f41a35f30 Patch detached cache API
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-07-10 16:14:33 +02:00
Michal Mielewczyk
41224c61c0 Track max number of cores for atomic volume
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-07-10 16:13:15 +02:00
Robert Baldyga
f0f6ff219b Set core volume type in metadata on core insert
ocf_metadata_flush_superblock() is being called on the cache stop, after
deinitialization of the cores (and their volumes), thus accessing core
volume in superblock flushing procedure leads to use-after-free bug.

Fix this by moving volume type setting to the core insertion code.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-06-28 07:59:43 +02:00
Michal Mielewczyk
edd42fed98 Avoid zero-size memcpy
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2022-04-08 16:10:28 +02:00
Adam Rutkowski
09b73461b4 Always modify valid_core_map together with core_count
.. to assure that superblock config state on drive is consistent

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-03-31 13:37:42 +02:00
Adam Rutkowski
4a839cd332 Verify standby/active cache state in OCF entry points
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-03-28 09:42:02 +02:00
Robert Baldyga
aa4622cc01 Make core remove error recoverable
First try to clean only the mapping. This operation does not require any
rollback, so even if flushing collision fails, core object is still
intact. In case of error we inform user that core was not removed by
returning new error code (-OCF_ERR_CORE_NOT_REMOVED).

After flushing collision succeeds we remove core from metadata and
flush superblock at the end. At that point the core is fully removed
from OCF and even if superblock flush error occurs there is nothing we
can do about it, so we just return the error code.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-03-25 21:32:55 +01:00
Jan Musial
e0cd0a4882 Fix message when try-adding already opened core
Signed-off-by: Jan Musial <jan.musial@intel.com>
2022-02-18 12:54:13 +01:00
Piotr Debski
9b980d3f22 fix for issue #1023
Better error for core size mismatch during activation/load

adding pyocf test for new error code

Signed-off-by: Piotr Debski <piotr.debski@intel.com>
2022-01-25 05:18:16 +01:00
Robert Baldyga
fb8bea67b6 Set core_seq_no only in atomic mode
This prevents using up pool of seq numbers in normal mode and blocking
addition of any new cores.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-01-19 11:38:12 +01:00
Rafal Stefanowski
b57bad4652 Fix core-zero-size error
Move error print to where it belongs, preventing this message to
pop up when same error code is reported elsewhere for other reason.

Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
2021-12-06 12:30:29 +01:00
Michal Mielewczyk
4ab22ee2dc Maintain runtime struct during failover standby
To allow the fastest switching from the passive-standby to active mode, the
runtime metadata must be kept 100% synced with the metadata on the drive and in
the RAM thus recovery is required after each collision section update.

To avoid long-lasting recovering of all the cachelines each time the collision
section is being updated, the passive update procedure recovers only those
which have its MD entries on the updated pages.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-11-19 11:58:09 +01:00
Rafal Stefanowski
0b39711b8b Add promote-on-threshold sequential cutoff switch
Decide whether to promote sequential cutoff stream
to global structures when threshold is reached

Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
2021-11-09 12:54:15 +01:00
Rafal Stefanowski
f22da1cde7 Fix license
Change license to BSD-3-Clause

Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
2021-10-28 13:08:50 +02:00
Krzysztof Majzerowicz-Jaszcz
71262d5097 Cache standby mode API changes
Error for an invalid cache operation while in passive mode added

Signed-off-by: Krzysztof Majzerowicz-Jaszcz <krzysztof.majzerowicz-jaszcz@intel.com>

Error name correction

Signed-off-by: Krzysztof Majzerowicz-Jaszcz <krzysztof.majzerowicz-jaszcz@intel.com>

API changes for passive cache mode

Moved the passive cache error return source to the api for flush and
set_param

Signed-off-by: Krzysztof Majzerowicz-Jaszcz <krzysztof.majzerowicz-jaszcz@intel.com>

Further API changes for passive cache mode

Signed-off-by: Krzysztof Majzerowicz-Jaszcz <krzysztof.majzerowicz-jaszcz@intel.com>

 Passive api - review changes

Signed-off-by: Krzysztof Majzerowicz-Jaszcz <krzysztof.majzerowicz-jaszcz@intel.com>
2021-10-22 15:10:53 +02:00
Robert Baldyga
cc22c57cb7 Set proper cache pointer in front volumes
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-06 13:49:21 +02:00
Robert Baldyga
e31e7283d9 Rework volume type management
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-03 17:22:22 +02:00
Michal Mielewczyk
26194fc536 Use cleaning ops wrapper functions
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-07-27 15:44:18 +02:00
Michal Mielewczyk
00aa56dd28 Wrapper functions for cleaning ops
The change should unify access to cleaning policy resources and facilitate
synchronization when switching cleaning policies

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-07-27 15:44:18 +02:00
Adam Rutkowski
87f834c793 Move common user and freelist partition data to a new struct
New structure ocf_part is added to contain all the data common for both
user partitions and freelist partition: part_runtime and part_id.
ocf_user_part now contains ocf_part structure as well as pointer to
cleaning partition runtime metadata (moved out from part_runtime) and
user partition config (no change here).

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-18 12:07:10 +02:00
Rafal Stefanowski
5486e159f4 Fix seq-cutoff promotion count message typo
Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
2021-06-11 06:02:01 +02:00
Michal Mielewczyk
19276570b8 Prevent adding core with the same UUID twice
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-04-14 16:56:09 +02:00
Robert Baldyga
3ee253cc4e Per-queue multi-stream sequential cutoff
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-03-04 16:38:31 +01:00
Michal Mielewczyk
f61472c3f4 Validate seq cutoff threshold value
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-02-26 08:24:41 -05:00
Michal Mielewczyk
93eccc862a Reset per-partition counters when adding core
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-02-03 06:18:44 -05:00
Rafal Stefanowski
6ed4cf8a24 Update copyright statements (2021)
Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
2021-01-21 13:17:34 +01:00
Robert Baldyga
5a88ab2d61 Flush metadata collision segment on core remove
If there is any dirty data on the cache associated with removed core,
we must flush collision metadata after removing core to make metadata
persistent in case of dirty shutdown.

This fixes the problem when recovery procedure erroneously interprets
cache lines that belonged to removed core as valid ones.

This also fixes the problem, when after removing core containing dirty
data another core is added, and then recovery procedure following dirty
shutdown assigns cache lines from removed core to the new one, effectively
leading to data corruption.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-01-19 13:34:28 +01:00
Robert Baldyga
56ece0fac8 seq_cutoff: Allocate seq cutoff structures dynamically per core
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-12-09 12:58:41 +01:00
Robert Baldyga
0dfdcb05e9 Fix core volume lifecycle management
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-08-21 16:40:41 +02:00
Robert Baldyga
d5ecdc16dd Make CRC mismatch on recovery a warning instead of error
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-07-28 07:49:29 +02:00
Rafal Stefanowski
38e7e19290 Update copyright statements
Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
2020-04-28 13:37:54 +02:00
Robert Baldyga
15fd53cbb0 Initialize seqential cutoff in try-add / load paths
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-04-23 00:41:53 +02:00
Robert Baldyga
93cd0615d3 Introduce multi-stream sequential cutoff
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-04-22 13:30:42 +02:00
Robert Baldyga
332ad1dfbc Make seq cutoff policy and threshold atomic variables
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-03-24 18:17:15 +01:00
Michal Rakowski
325994074e env: change env_strncmp to take 4 args
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-09-30 17:26:47 +02:00
Slawomir_Jankowski
cdf0caf704 **ocf_mngt.h**: In core name change
pointer type to array which is 32 characters long;
**core.py**: Add missing import and modify class' field type
to keep consistency;
**ocf_mngt_core**: Remove local variable 'name';
remove env_vmalloc for 'name' - isn't no longer needed;
remove initialization 'name' - as above;
remove env_vfree for context->cfg.name - variable isn't no allocated
in memory;
check if cfg->name exists;
change label in goto from deleted err_name to the closest err_pipeline.

Signed-off-by: Slawomir_Jankowski <slawomir.jankowski@intel.com>
2019-09-30 15:55:33 +02:00
Michal Rakowski
83e23c5593 Fixed some bugs found by the coverity tool
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-09-16 15:49:37 +02:00
Michal Mielewczyk
cdc0a575a1 Added 'added' flag in core runtime data.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-08-06 07:36:39 -04:00
Michal Mielewczyk
433a25a1b2 Renamed 'added' flag in core metadata to 'valid'.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-08-06 07:08:12 -04:00
Robert Baldyga
92c7e12549 Remove core id from public API
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-07-30 09:26:26 +02:00
Robert Baldyga
259df7ace9 Store core name in metadata
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-07-30 09:26:26 +02:00
Robert Baldyga
4f0735b503 Ensure that core name is set and unique
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-07-29 17:37:48 +02:00
Jan Musial
2c629be4c2 Fix leaking front and core volumes
Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-06-26 10:00:49 +02:00
Michal Mielewczyk
fc5334e419 Return memcpy result 2019-06-11 12:12:07 +02:00
Michal Mielewczyk
e6bedb692c Unified management functions prefix.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-06-05 09:31:59 -04:00
Robert Baldyga
711de86bff Associate core metadata with core object
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-05-28 14:49:59 +02:00
Robert Baldyga
bdcd4df0ef Remove utils_device.h
Move core mngt related code to ocf_mngt_core.c

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-05-27 17:00:39 +02:00