numam-spdk/test
Tomasz Zawadzki ab691e3d5a bdev/ocf: take additional reference for ocf_cache
Fixes #1498

When shutting down the application, it was possible to
reference stale ocf_cache pointer. This was the case
when two or more vbdev_ocf devices were based on top
of single cache bdev.

This issue did not occur outside of the shutdown case,
since RPC only allows deletion of the vbdev_ocf.
This erases on disk metadata and next run of the application,
would not detect such vbdev_ocf.

Shutdown meanwhile works different, by first stopping
the instance of running "ocf_mngt_cache" and later detaching
"core" devices (the ones being cached). This prevented
erasing the on disk metadata and allowed for restarted
application to detect vbdev_ocf.
See patch (1292ef2) for details.

Since references to ocf_cache are copied between vbdev_ocf
[see start_cache()], the reference count inside ocf_cache
was limited to original ocf_mngt_cache_start() and
management queue creation. First call into ocf_mngt_cache_stop()
released all references to ocf_cache. Leaving other
vbdev_ocfs pointing to released memory.

This patch works around this issue by increasing ref cnt
on ocf_cache for each vbdev based on top of it.
It allows to call into ocf_mngt_cache_stop(), but not
release the memory for ocf_cache until last vbdev.

Note:
A proper redesign here is in order:
- either rearranging structures to be based around single ocf_cache,
rather than multiple vbdev_ocf instances
- better use of OCF API to reduce book keeping logic in vbdev

There are plans to implement detach/attach in RPC,
so it should be a focus during that effort.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3574 (master)

(cherry picked from commit 1350922d09)
Change-Id: I560a7fbb1c052bf53970e655bdb60803c561a252
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3593
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-07-31 07:07:10 +00:00
..
app test/fuzz: fix nvmf fuzzer for AERs. 2020-07-23 07:25:28 +00:00
bdev test/bdevperf: test config file 2020-07-30 06:58:50 +00:00
blobfs make: Create variable for event_bdev dependencies 2020-07-08 07:56:46 +00:00
blobstore build: Example applications build to build/example 2020-06-15 15:27:16 +00:00
common pkgdep/git: Fix QAT permision error during install 2020-07-31 07:07:10 +00:00
compress module/compress: add new parm to RPC for create compress vol 2020-07-30 06:58:50 +00:00
config_converter test/config_converter: Declare $rootdir, $testdir paths 2020-02-20 09:54:15 +00:00
cpp_headers queue_extras: use SPDK_CONTAINEROF 2019-10-07 15:06:01 +00:00
dd test/dd: Rerun POSIX tests with AIO 2020-07-24 09:40:00 +00:00
dpdk_memory_utility build: Output executables from the app directory to build/bin 2020-06-15 15:27:16 +00:00
env env_dpdk/pci: remove driver->is_registered 2020-07-23 20:48:47 +00:00
event test/event: add app_repeat test case 2020-07-24 15:25:57 +00:00
external_code dpdkbuild: build dpdk with meson+ninja 2020-07-24 22:06:11 +00:00
ftl test/ftl: point to absolute path to setup.sh 2020-07-06 23:22:59 +00:00
fuzz check_format: Reformat the Bash code in compliance with shfmt 2020-05-07 20:52:21 +00:00
ioat build: Example applications build to build/example 2020-06-15 15:27:16 +00:00
iscsi_tgt lib/iscsi: Manage free connections not by array but by TAILQ 2020-07-13 08:39:50 +00:00
json_config sock: Save socket subsystem configuration in JSON format 2020-07-13 08:40:15 +00:00
lvol build: Output executables from the app directory to build/bin 2020-06-15 15:27:16 +00:00
make env_dpdk/pci: remove device detach callback 2020-07-23 20:48:47 +00:00
nvme test/nvme_perf: add option for dpdk mem measurements 2020-07-24 17:09:03 +00:00
nvmf example/nvme: add application to test NVMe I/O abort 2020-07-17 07:21:13 +00:00
ocf bdev/ocf: take additional reference for ocf_cache 2020-07-31 07:07:10 +00:00
openstack test/nvmf: Handle multiple arguments in nvmfappstart() 2020-05-13 07:46:04 +00:00
pmem build: Output executables from the app directory to build/bin 2020-06-15 15:27:16 +00:00
rpc build: Output executables from the app directory to build/bin 2020-06-15 15:27:16 +00:00
rpc_client lib/event: fix printing non-null-terminated strings 2020-04-06 07:48:37 +00:00
spdkcli lvol: report io_unit_size as block_size instead of page size 2020-07-17 07:20:14 +00:00
unit nvmf/fc/ut: Add missing function stub 2020-07-30 06:58:50 +00:00
vhost test/vhost: add option for fio gtod_reduce 2020-07-24 15:41:46 +00:00
vmd build: Example applications build to build/example 2020-06-15 15:27:16 +00:00
Makefile build: add option to disable building unit tests 2020-03-10 09:12:21 +00:00
spdk_cunit.h test: remove leftover spdk_cunit declaration 2018-07-06 22:47:56 +00:00