Spdk/lib/nvmf
Peng Lian b13ee3005d nvmf: clean sgroup->queued in _nvmf_qpair_destroy when ctrlr is NULL
Let us consider the following process:
  1. one fabric connect request A comes but the subsystem is paused
     due to adding/removing ns or other operations, so this request A
     will be put into sgroup->queued until the subsystem becomes active;
  2. the subsystem is paused for a long time until the connect timeout,
     related qpair is destroyed, the sgroup->queued will not be cleaned
     because qpair's ctrlr is NULL;
  3. if a new request B comes, it is more likely to be allocated to the
     same memory as the previous fabric command request. And it will be
     put into sgroup->queued again, where has already exists the exactly
     same pointer with request B.

This leads to the pointer hanging problem and it will cause infinitely
loop when traversing sgroup->queued!

So this patch avoids the ptr-hanging problem by checking and cleaning
all sgroups queued req whose qpair is the being destroyed qpair in
_nvmf_qpair_destroy when ctrlr is NULL.

This problem is already described in issue #2133.

Signed-off-by: Peng Lian<peng.lian@smartx.com>
Change-Id: I909d673b5050f21fa193914cc4ffe6634232fa7d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17147
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2023-03-22 10:11:30 +00:00
..
ctrlr_bdev.c bdev: Add default copy command support in bdev 2023-03-07 11:52:45 +00:00
ctrlr_discovery.c update Intel copyright notices 2022-11-10 08:28:53 +00:00
ctrlr.c bdev: Add default copy command support in bdev 2023-03-07 11:52:45 +00:00
fc_ls.c update Intel copyright notices 2022-11-10 08:28:53 +00:00
fc.c nvmf/fc: fix memleaks 2023-03-06 13:21:38 +00:00
Makefile so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
nvmf_fc.h update Intel copyright notices 2022-11-10 08:28:53 +00:00
nvmf_internal.h nvmf: pause/resume polling for the target 2023-01-24 14:49:24 +00:00
nvmf_rpc.c nvmf: introduce async transport create 2023-02-16 16:45:08 +00:00
nvmf.c nvmf: clean sgroup->queued in _nvmf_qpair_destroy when ctrlr is NULL 2023-03-22 10:11:30 +00:00
rdma.c freebsd: return negated error from getaddrinfo() 2023-03-10 16:44:37 +00:00
spdk_nvmf.map nvmf: introduce async transport create 2023-02-16 16:45:08 +00:00
subsystem.c nvmf: handle iovecs in reservation handling 2023-02-13 13:50:51 +00:00
tcp.c tcp: add note about default case in qpair_abort_request() 2023-02-13 13:50:15 +00:00
transport.c nvmf: disable data buf mempool cache 2023-02-28 08:57:23 +00:00
transport.h update Intel copyright notices 2022-11-10 08:28:53 +00:00
vfio_user.c nvmf/vfio_user: simplify cq_is_full() 2023-03-08 08:45:00 +00:00