Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nvme-rdma: Free the I/O tags when we delete the controller

If we wait until we free the controller (free_ctrl) we might
lose our rdma device without any notification while we still
have open resources (tags mrs and dma mappings).

Instead, destroy the tags with their rdma resources once we
delete the device and not when freeing it.

Note that we don't do that in nvme_rdma_shutdown_ctrl because
controller reset uses it as well and we want to give active I/O
a chance to complete successfully.

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Christoph Hellwig <hch@lst.de>

+7 -5
+7 -5
drivers/nvme/host/rdma.c
··· 686 686 list_del(&ctrl->list); 687 687 mutex_unlock(&nvme_rdma_ctrl_mutex); 688 688 689 - if (ctrl->ctrl.tagset) { 690 - blk_cleanup_queue(ctrl->ctrl.connect_q); 691 - blk_mq_free_tag_set(&ctrl->tag_set); 692 - nvme_rdma_dev_put(ctrl->device); 693 - } 694 689 kfree(ctrl->queues); 695 690 nvmf_free_options(nctrl->opts); 696 691 free_ctrl: ··· 1660 1665 nvme_uninit_ctrl(&ctrl->ctrl); 1661 1666 if (shutdown) 1662 1667 nvme_rdma_shutdown_ctrl(ctrl); 1668 + 1669 + if (ctrl->ctrl.tagset) { 1670 + blk_cleanup_queue(ctrl->ctrl.connect_q); 1671 + blk_mq_free_tag_set(&ctrl->tag_set); 1672 + nvme_rdma_dev_put(ctrl->device); 1673 + } 1674 + 1663 1675 nvme_put_ctrl(&ctrl->ctrl); 1664 1676 } 1665 1677