Spdk/lib
Jim Harris 9d0bd899ed nvmf: fix trid comparison for discovery subsystem entries
When generating a discovery log page, we will add entries
for the discovery subsystem for all listeners except the
one associated with the controller that generated the
log page command.  We do this comparison using
spdk_nvme_transport_id_compare().

But this function compares the subnqn of the trid, and
the subnqn is not set in either of the trids that we
are comparing.

The listener's trid always has an empty subnqn, but
the source trid has an uninitialized subnqn when
we do the comparison.  This means that sometimes the
subnqn may be empty (which always happens in debug
builds) but sometimes may contain garbage.  This
means that sometimes an entry would be added to the
log, even for the trid of the discovery controller
that generated the command (meaning the discovery
controller would end up referring to itself which
is not allowed).

There is an even more subtle issue with this.  If the
host reads just the log page header, the nvmf target
generates the entire log page, and just returns the
header contents.  Let's say in this case, the source
trid has an empty subnqn, so we don't generate an entry
for it, and report numrec = X and genctr = Y.  Then
the host reads the X log page entries.  But now the
source trid is garbage, so a discovery log page entry
is returned, replacing one of the "real" log page
entries.  And since genctr didn't change, the host
thinks the data is all valid, meaning there's a log
page entry for an NVM subsystem that ends up getting
dropped.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I96cfc566ddaf17153aec089bf3d9b3480bec3e4b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11933
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2022-03-14 08:44:21 +00:00
..
accel accel/idxd: add and respect flag to support writes to PMEM 2022-03-04 21:56:54 +00:00
bdev bdev: Use iovec to save original md buffer in IO request 2022-03-09 08:02:19 +00:00
blob blob: add return codes to bs_user_op_abort 2022-03-02 08:39:50 +00:00
blobfs so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
conf so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
dma so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
env_dpdk env/memory: fix unregistration of memory after memory registration issue 2022-03-09 09:06:30 +00:00
env_ocf bdev/ocf: Improve OCF mpools 2022-03-02 08:34:39 +00:00
event event: Add a user option to change the size of spdk_msg_mempool 2022-03-09 08:00:28 +00:00
ftl so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
idxd idxd: introduce new IDXD flag for cache control 2022-03-04 21:56:54 +00:00
init so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
ioat so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
iscsi iscsi: fix a memory leak in error handling 2022-02-24 14:55:16 +00:00
json so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
jsonrpc so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
log so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
lvol lvol: finish initial iteration even if blob has no name 2022-02-03 19:43:35 +00:00
nbd so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
notify so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
nvme nvme_tcp: Remove qpair from group->needs_poll when removing it from poll_group 2022-03-14 08:44:03 +00:00
nvmf nvmf: fix trid comparison for discovery subsystem entries 2022-03-14 08:44:21 +00:00
rdma so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
reduce so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
rocksdb rocksdb: fix thread name typo 2021-09-03 08:08:20 +00:00
rpc so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
scsi thread: add spdk_thread_exec_msg() 2022-02-23 10:06:49 +00:00
sock so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
thread event: Add a user option to change the size of spdk_msg_mempool 2022-03-09 08:00:28 +00:00
trace so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
trace_parser so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
ut_mock so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
util util/dif: check metadata buffer in spdk_dix_verify() 2022-02-10 22:41:26 +00:00
vfio_user so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
vhost lib/vhost: move virtio related functions to rte_vhost 2022-03-09 08:01:51 +00:00
virtio so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
vmd vmd: reset root port config before enumeration 2022-03-10 16:45:18 +00:00
Makefile lib/trace_parser: add trace_parser library stubs 2021-09-29 08:57:58 +00:00