numam-spdk/lib/nvme
Jim Harris 792807a444 nvme: fix infinite loop when aborting queued reqs
When we disconnect a qpair, part of the code path is
calling _nvme_qpair_abort_queued_reqs.  This takes
care of aborting any requests that were queued waiting
for slots to open on the submission queue.
It walks the STAILQ one by one and manually completes
them with ABORT status back to the caller.

But if the callback path submits another request, this
request may also get queued to the end of the queued_req
TAILQ.  This can result in an infinite loop.

The solution is to use an STAILQ_SWAP to a local, empty
STAILQ.  Then we ensure we only abort the requests that
were queued when _nvme_qpair_abort_queued_reqs() started
executing.

Fixes issue #1588.

I used the multipath.sh test to reproduce this on my local
system. If it ever dropped into the STAILQ loop in this
function, we would hit the infinite loop.  With this patch,
I confirmed locally that now we safely avoid the infinite
loop and the test passes.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I657db23efe5983bd8613c870ad62695a7fc7f689
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4284
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-09-17 21:34:58 +00:00
..
Makefile nvme: add initial namespace types support 2020-09-11 07:29:51 +00:00
nvme_ctrlr_cmd.c lib/nvme: Add spdk_nvme_ctrlr_cmd_abort_ext() to abort commands whose cb_arg matches 2020-07-14 07:54:42 +00:00
nvme_ctrlr_ocssd_cmd.c ocssd: hold lock when calling nvme_ctrlr_submit_admin_request 2019-02-15 21:27:58 +00:00
nvme_ctrlr.c nvme: expose functions to manage queue identifiers 2020-09-15 07:13:46 +00:00
nvme_cuse.c nvme/cuse: fix nblocks and block_size in rw path 2020-09-04 08:13:56 +00:00
nvme_cuse.h lib/nvme: add RPC for interacting with CUSE devices 2019-10-24 23:43:59 +00:00
nvme_fabric.c lib/nvme: make fabrics connect timeout configurable. 2020-08-19 07:29:19 +00:00
nvme_internal.h lib/nvme: make fabrics connect timeout configurable. 2020-08-19 07:29:19 +00:00
nvme_io_msg.c lib/nvme: update io msg producers on ns manage 2020-06-05 09:01:44 +00:00
nvme_io_msg.h lib/nvme: update io msg producers on ns manage 2020-06-05 09:01:44 +00:00
nvme_ns_cmd.c lib: net, notify, nvme, rocksdb remove spdk_ prefix. 2020-05-21 09:19:00 +00:00
nvme_ns_ocssd_cmd.c nvme: save separate metadata size to nvme request 2020-04-02 07:02:38 +00:00
nvme_ns.c nvme: add initial namespace types support 2020-09-11 07:29:51 +00:00
nvme_opal_internal.h nvme/opal: deprecate spdk_opal_supported() 2020-05-20 14:16:44 +00:00
nvme_opal.c lib/nvme: Remove inclusion of SPDK event library 2020-06-01 09:20:41 +00:00
nvme_pcie.c nvme/pci: Check for command completions after deleting submission queue 2020-09-04 08:14:44 +00:00
nvme_poll_group.c lib/nvme: switch poll group to use connect/disconnect semantics. 2020-04-22 19:06:26 +00:00
nvme_qpair.c nvme: fix infinite loop when aborting queued reqs 2020-09-17 21:34:58 +00:00
nvme_quirks.c env: add spdk_pci_id->class_id 2020-07-23 20:48:47 +00:00
nvme_rdma.c nvme/rdma: Check that SGL descriptors fit into ICD 2020-09-16 07:58:13 +00:00
nvme_tcp.c nvme/tcp: Rename r2t_recv, set this flag when send_ack is 0 2020-09-16 07:58:59 +00:00
nvme_transport.c nvme/transport: addd assert for transport. 2020-07-29 07:37:26 +00:00
nvme_uevent.c nvme: increase size of uevent buffer to 1MB 2020-09-08 07:49:32 +00:00
nvme_uevent.h nvme: read all uevents 2020-08-24 07:38:33 +00:00
nvme.c nvme: don't assert on custom transport 2020-08-21 08:23:19 +00:00
spdk_nvme.map nvme: expose functions to manage queue identifiers 2020-09-15 07:13:46 +00:00