_ocf_mngt_cache_unplug context is now provided by the caller.
This way _ocf_mngt_cache_unplug returns only non-critical (cache write)
errors, allowing stop/detach operation to always proceed and optionally
finish with error. This eliminates the need for rolling back previous
stop/detach operations, which might turn out to be impossible e.g.
under memory pressure.
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
'ENV' variable is set and used by OS utilities on some Linux
distros, interfering with OCF build system. Renaming ENV and
other ENV* variables to OCF_ENV* to avoid conflicts.
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
Don't reassign value of cache without any previus use.
It produced warnings when analyzing with scanbuild.
Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Tests for starting cache and checking if mode works properly
Tests for stopping cache
Negative and stress tests
Signed-off-by: Daniel Madej <daniel.madej@intel.com>
OCF depends on ENV_BUG_ON condition to be evaluated as it
may have side effects. So simple implementation with
"assert(!cond)" is not good enough as it will likely be noop
in release build.
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
Adapter can opt to take additional steps to securely allocate
memory used by OCF to store cache metadata. Typically this would
involve mlocking pages and zeroing memory before deallocation.
Memory allocated using secure_alloc is not expected to be zeroed
or physically continous.
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
* Add references to Cores in Cache, ctx holds caches, caches hold cores,
everything gets cleaned up nicely
* GC in Python seems to be a bit lazy, if we want to run CI on
low-memory machines we need to make sure it does run in between tests
'cause we don't want no huge Volumes hanging around for long
Signed-off-by: Jan Musial <jan.musial@intel.com>
Implement simple secure erase tests. Perform IO that will trigger
copying of Data buffers and make sure OCF calls secure erase on them.
Signed-off-by: Jan Musial <jan.musial@intel.com>
Volume close should not close underlying device until all
I/O targeting this volume are deallocated. To achieve this
a reference counter is added to volume. Counter value
matches number of I/O objects associated with volume. Counter
is freezed when volume is closed, blocking allocation of new
I/O objects.
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This is useful when reference counter is initialized in non-zeroed
memory (or assuming atomic variable is not properly initialized by
memseting to zero).
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
Due the aggresive security checks in compiler 'printf' might be substituded with
'__printf_chk'. However it does not differentiate whether substituted string is
library function call whether field in structure.
By renaming field we prevent it to be unintentionally subustituted by the
preprocessor.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
Fix some instance tracking to prevent Python-side objects from leaking
buffers.
Also, reduce min size of Cache instance (real minimum should be around ~~19MiB,
but we need to make it more deterministic and 20 MiB seems to be reasonable).
Still some stuff left to do, but it needs more investigation and, for
now, this should suffice just to enable some form of CI.
Signed-off-by: Jan Musial <jan.musial@intel.com>
Errors not related to cache disk I/O failure should force
cache stop to return with error without deinitializing cache
instance.
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>