Spdk/test
Seth Howell 12f85fa320 nvmf: don't keep a global discovery log page.
Keeping a global discovery log page was meant to be a time saving
mechanism, but in the current implementation, it doesn't work properly,
and can cause undesirable behavior and potential crashes. There are two
main problems with keeping a global log page.

1. Admin qpairs can be assigned to any SPDK thread. This means that when
multiple initiators connect to the host and request the discovery log,
they can both be running through the spdk_nvmf_ctrlr_get_log_page
function at the same time. In the event that the discovery generation
counter is incremented while these accesses are occurring, it can cause
one or both of the threads to update the log at the same time. This
results in both logs trying to free the old log page (double free) and
set their log as the new one (possible memory leak).

2. The second problem is that each host is supposed to get a unique
discovery log based on the subsystems to which they have access.
Currently the code relies on whether the discovery log page offset in
the request is equal to 0 to determine if it should load a new discovery
log page or use the cached one. This is inherently faulty because it
relies on initiator provided value to determine what information to
provide from the log page. An initiator could easily send a discovery
request with an offset greater than 0 on purpose to procure most of a
log page provided to another host.

Overall, I think it's safest to not cache the log page at all anymore
and rely on a thread local fresh log page each time.

Reported-by: Curt Bruns <curt.e.bruns@intel.com>

Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466839 (master)

(cherry picked from commit 20b35d769d)
Change-Id: Ib048e26f139927d888fed7019e0deec346359582
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467594
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-09-10 22:27:45 +00:00
..
app lib: move trace_rpc into lib/trace 2019-09-06 02:19:41 +00:00
bdev lib: move trace_rpc into lib/trace 2019-09-06 02:19:41 +00:00
blobfs test/rocksdb: remove run_tests.sh 2019-07-05 12:13:16 +00:00
blobstore test: remove duplicated set -ex from tests 2019-06-19 03:54:58 +00:00
common mk: move the bdev modules under module directory. 2019-09-06 02:19:41 +00:00
compress test/compress: add bdevio and bdevperf tests 2019-07-30 07:36:03 +00:00
config_converter iscsi: Deprecate MinConnectionsPerCore 2019-05-06 17:10:48 +00:00
cpp_headers Makefile: Add possibility to uninstall spdk. 2019-05-16 20:56:18 +00:00
env ut/cunit: added missing semicolon on CU_ASSERT macros 2019-07-24 18:21:22 +00:00
event notify: add notification library 2019-03-29 21:15:14 +00:00
ftl test/ftl: use non-volatile cache in functional tests 2019-07-25 22:36:31 +00:00
fuzz test/fuzz: Make test timeout configurable. 2019-07-23 04:08:52 +00:00
ioat test: remove duplicated set -ex from tests 2019-06-19 03:54:58 +00:00
iscsi_tgt net/vpp: move to VPP 19.04 2019-07-25 14:51:21 +00:00
json_config scripts/rpc: change construct_crypto_bdevs args to positional 2019-07-24 18:23:02 +00:00
lvol test/lvol: Check if snapshot with snapshot can be deleted 2019-07-12 08:26:04 +00:00
make test: add a test to confirm shared object deps. 2019-09-06 02:19:41 +00:00
nvme test/nvme: do not use mounted nvme disks in perf script 2019-07-24 17:57:27 +00:00
nvmf test/nvmf: Add test for nvmf_get_stats RPC method 2019-07-29 18:05:09 +00:00
ocf test/ocf: disable persistent metadata test 2019-06-11 18:16:55 +00:00
openstack test/openstack: Add scripts to test spdk-vs-openstack 2019-07-25 15:27:43 +00:00
pmem test/pmem: cleanup common.sh 2019-06-19 03:54:58 +00:00
rpc_client jsonrpc: tolerate null json value for parameters in json-rpc call 2019-07-26 19:30:57 +00:00
spdkcli test/spdkcli: test vhost_target show_details method 2019-07-26 19:50:13 +00:00
unit nvmf: don't keep a global discovery log page. 2019-09-10 22:27:45 +00:00
vhost test/vhost: check block size for vhost boot test 2019-07-23 22:51:28 +00:00
vmd test/vmd: enable_vmd RPC test 2019-07-29 20:40:56 +00:00
Makefile jsonrpc-client: add new C client library 2018-10-11 20:07:44 +00:00
spdk_cunit.h test: remove leftover spdk_cunit declaration 2018-07-06 22:47:56 +00:00