Spdk/module/bdev
Shuhei Matsumoto 068ca77ab2 bdev/nvme: Disconnect and then free I/O qpair when deleting ctrlr_channel
For RDMA transport, current synchronous qpair disconnect occupied CPU for
a second when qpair disconnect gets timeout.

To remove this limitation, we will do the following:
- make spdk_nvme_ctrlr_disconnect_io_qpair() asynchronous,
- spdk_nvme_qpair_process_completions() returns -ENXIO only if the
  qpair is actually disconnected.

Even at this patch, spdk_nvme_poll_group_process_completions() invokes
disconnected_qpair_cb only if a qpair is actually disconnected. This
behavior will be maintained.

To use the upcoming asynchronous qpair disconnect easily, when
deleting a ctrlr_channel, disconnect the qpair, and then free the qpair
and release a reference to the poll group when the qpair is actually
disconnected.

We need to delete a nvme_qpair asynchronously after the corresponding
nvme_ctrlr_channel is deleted and defer the deletion of the corresponding
nvme_ctrlr until the nvme_qpair is deleted. To satisfy this requirement,
utilize the reference count of the nvme_ctrlr.

disconnected_qpair_cb() may call spdk_nvme_ctrlr_free_io_qpair() and
spdk_io_device_unregister() successively. The spdk_io_device_unregister()
will execute spdk_nvme_detach_async() from its callback.
spdk_nvme_ctrlr_free_io_qpair() has to complete earlier than
spdk_nvme_detach_async() starts. spdk_nvme_ctrlr_free_io_qpair() is
executed after unwinding stack. spdk_nvme_detach_async() is executed
after sending a message. Sending message is later than unwinding stack.
Hence the requirement is satisfied naturally.

spdk_io_device_unregister() for the nvme_ctrlr is required to be called
on the nvme_ctrlr->thread. To satisfy this requirement, redirect
nvme_ctrlr_unregister() to the nvme_ctrlr->thread. This change is too
small to stand as an independent patch. So include the change in this
patch.

Change-Id: Id8c01966c40b1dae9c4ef17f1b0b3f60a0bd17d5
Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10765
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2022-03-15 09:05:09 +00:00
..
aio bdev/aio: Correct error message when IO fails 2022-02-22 09:03:51 +00:00
compress module/bdev/compress: print a reasonable message on create error 2022-03-08 07:50:49 +00:00
crypto bdev/crypto: Fixed g_session_mp init error handling 2022-03-08 15:07:46 +00:00
delay so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
error so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
ftl so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
gpt so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
iscsi so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
lvol so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
malloc accel: plumb accel flags through operations that need them 2022-03-04 21:56:54 +00:00
null bdev/null: call spdk_bdev_module_fini_done() even if not registered 2022-03-02 08:39:40 +00:00
nvme bdev/nvme: Disconnect and then free I/O qpair when deleting ctrlr_channel 2022-03-15 09:05:09 +00:00
ocf bdev/ocf: Improve OCF mpools 2022-03-02 08:34:39 +00:00
passthru so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
pmem so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
raid so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
rbd so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
split so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
uring so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
virtio so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
zone_block so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
Makefile bdev: move bdev_rpc library contents 2020-09-25 11:43:42 +00:00