numam-spdk/lib
Seth Howell 20b35d769d 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>

Change-Id: Ib048e26f139927d888fed7019e0deec346359582
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466839
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-09-03 00:30:59 +00:00
..
bdev bdev/part: remove thread safety from part_construct() 2019-08-30 15:48:02 +00:00
blob lib/blob: move bdev subdir under module directory. 2019-08-22 16:29:49 +00:00
blobfs blobfs: use __wake_caller() to wake up the caller 2019-08-14 21:41:36 +00:00
conf string: spdk_strtol to delegate additional error checking 2019-01-29 00:10:57 +00:00
copy lib/copy: move ioat subdir to module directory. 2019-08-22 16:29:49 +00:00
env_dpdk env_dpdk/memory: aggregate adjacent vfio mappings 2019-08-30 19:41:49 +00:00
env_ocf lib/mk: update OCF build. 2019-08-27 18:49:56 +00:00
event lib/event: remove app.c dependency from loading json_config 2019-08-28 15:26:12 +00:00
ftl lib/ftl: IO channel handling for nv cache 2019-08-29 18:10:19 +00:00
ioat ioat: allocate device struct using regular calloc 2019-04-09 06:30:42 +00:00
iscsi iscsi: Restore the previous bug fix for LUN hot plug 2019-08-23 18:09:16 +00:00
json json_util: fix typo in debug message. 2019-05-31 14:39:53 +00:00
jsonrpc jsonrpc: tolerate null json value for parameters in json-rpc call 2019-07-26 19:30:57 +00:00
log mk: move log_rpc from inside log 2019-08-15 20:32:28 +00:00
log_rpc mk: move log_rpc from inside log 2019-08-15 20:32:28 +00:00
lvol lvol: Fix for lvol failed deletion flow 2019-04-02 19:23:22 +00:00
nbd nbd/rpc: Add logs with more information about rpc error. 2019-08-14 22:11:40 +00:00
net net/rpc: Add logs with more information about rpc error. 2019-08-05 06:14:58 +00:00
notify lib: move notify_rpc under lib/notify 2019-08-19 06:10:30 +00:00
nvme nvme/tcp: Change hdr in nvme_tcp_pdu to pointer 2019-08-28 15:38:02 +00:00
nvmf nvmf: don't keep a global discovery log page. 2019-09-03 00:30:59 +00:00
reduce lib/reduce: enable deletion of a vol w/o a pmem file 2019-08-22 04:31:46 +00:00
rocksdb RocksDB: Remove static and assert for SpdkInitializeThread 2019-07-05 04:19:11 +00:00
rpc lib/rpc: Add include_aliases flag to rpc_get_methods implementation. 2019-08-28 15:19:17 +00:00
scsi scsi: fail invalid MODE_SELECT requests 2019-08-05 23:15:08 +00:00
sock lib/sock: move subdirs to module/sock 2019-08-22 16:29:49 +00:00
thread thread: Assign not pointer but instance of spdk_cpuset in struct spdk_thread 2019-07-04 00:30:22 +00:00
trace lib: move trace_rpc into lib/trace 2019-08-19 06:10:30 +00:00
ut_mock thread: Eliminate use of pthread_self and thread_ids 2019-01-15 16:53:12 +00:00
util dif: Add spdk_dix_remap_ref_tag to remap ref. tag for separate metadata payload 2019-07-11 11:14:22 +00:00
vhost vhost: remove session type checks 2019-08-26 17:24:04 +00:00
virtio lib/virtio: change the definition of cookie 2019-06-26 08:03:37 +00:00
vmd lib/vmd: check header_type after the vmd_adapter structure is verified 2019-07-23 19:55:04 +00:00
Makefile mk: standardize DIRS-x assignments. 2019-08-29 20:16:18 +00:00