20b35d769d
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> |
||
---|---|---|
.. | ||
bdev | ||
blob | ||
blobfs | ||
conf | ||
copy | ||
env_dpdk | ||
env_ocf | ||
event | ||
ftl | ||
ioat | ||
iscsi | ||
json | ||
jsonrpc | ||
log | ||
log_rpc | ||
lvol | ||
nbd | ||
net | ||
notify | ||
nvme | ||
nvmf | ||
reduce | ||
rocksdb | ||
rpc | ||
scsi | ||
sock | ||
thread | ||
trace | ||
ut_mock | ||
util | ||
vhost | ||
virtio | ||
vmd | ||
Makefile |