diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-09-15 16:22:59 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-09-15 16:22:59 -0400 |
commit | 46626600d120dc48ab605265677b858506a81011 (patch) | |
tree | 3871c6ef5f80ebcad1dcf1d88dc005e41956af0b | |
parent | 1c109fabbd51863475cd12ac206bdd249aee35af (diff) | |
parent | 3bc42f3f0ef13a8239138a4c00a0b782f029f23d (diff) |
Merge branch 'for-linus' of git://git.kernel.dk/linux-block
Pull block fixes from Jens Axboe:
"A set of fixes for the current series in the realm of block.
Like the previous pull request, the meat of it are fixes for the nvme
fabrics/target code. Outside of that, just one fix from Gabriel for
not doing a queue suspend if we didn't get the admin queue setup in
the first place"
* 'for-linus' of git://git.kernel.dk/linux-block:
nvme-rdma: add back dependency on CONFIG_BLOCK
nvme-rdma: fix null pointer dereference on req->mr
nvme-rdma: use ib_client API to detect device removal
nvme-rdma: add DELETING queue flag
nvme/quirk: Add a delay before checking device ready for memblaze device
nvme: Don't suspend admin queue that wasn't created
nvme-rdma: destroy nvme queue rdma resources on connect failure
nvme_rdma: keep a ref on the ctrl during delete/flush
iw_cxgb4: block module unload until all ep resources are released
iw_cxgb4: call dev_put() on l2t allocation failure
-rw-r--r-- | drivers/infiniband/hw/cxgb4/cm.c | 6 | ||||
-rw-r--r-- | drivers/infiniband/hw/cxgb4/device.c | 5 | ||||
-rw-r--r-- | drivers/infiniband/hw/cxgb4/iw_cxgb4.h | 1 | ||||
-rw-r--r-- | drivers/nvme/host/pci.c | 9 | ||||
-rw-r--r-- | drivers/nvme/host/rdma.c | 144 |
5 files changed, 90 insertions, 75 deletions
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index b6a953aed7e8..80f988984f44 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c | |||
@@ -333,6 +333,8 @@ static void remove_ep_tid(struct c4iw_ep *ep) | |||
333 | 333 | ||
334 | spin_lock_irqsave(&ep->com.dev->lock, flags); | 334 | spin_lock_irqsave(&ep->com.dev->lock, flags); |
335 | _remove_handle(ep->com.dev, &ep->com.dev->hwtid_idr, ep->hwtid, 0); | 335 | _remove_handle(ep->com.dev, &ep->com.dev->hwtid_idr, ep->hwtid, 0); |
336 | if (idr_is_empty(&ep->com.dev->hwtid_idr)) | ||
337 | wake_up(&ep->com.dev->wait); | ||
336 | spin_unlock_irqrestore(&ep->com.dev->lock, flags); | 338 | spin_unlock_irqrestore(&ep->com.dev->lock, flags); |
337 | } | 339 | } |
338 | 340 | ||
@@ -2117,8 +2119,10 @@ static int import_ep(struct c4iw_ep *ep, int iptype, __u8 *peer_ip, | |||
2117 | } | 2119 | } |
2118 | ep->l2t = cxgb4_l2t_get(cdev->rdev.lldi.l2t, | 2120 | ep->l2t = cxgb4_l2t_get(cdev->rdev.lldi.l2t, |
2119 | n, pdev, rt_tos2priority(tos)); | 2121 | n, pdev, rt_tos2priority(tos)); |
2120 | if (!ep->l2t) | 2122 | if (!ep->l2t) { |
2123 | dev_put(pdev); | ||
2121 | goto out; | 2124 | goto out; |
2125 | } | ||
2122 | ep->mtu = pdev->mtu; | 2126 | ep->mtu = pdev->mtu; |
2123 | ep->tx_chan = cxgb4_port_chan(pdev); | 2127 | ep->tx_chan = cxgb4_port_chan(pdev); |
2124 | ep->smac_idx = cxgb4_tp_smt_idx(adapter_type, | 2128 | ep->smac_idx = cxgb4_tp_smt_idx(adapter_type, |
diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c index 071d7332ec06..3c4b2126e0d1 100644 --- a/drivers/infiniband/hw/cxgb4/device.c +++ b/drivers/infiniband/hw/cxgb4/device.c | |||
@@ -872,9 +872,13 @@ static void c4iw_rdev_close(struct c4iw_rdev *rdev) | |||
872 | static void c4iw_dealloc(struct uld_ctx *ctx) | 872 | static void c4iw_dealloc(struct uld_ctx *ctx) |
873 | { | 873 | { |
874 | c4iw_rdev_close(&ctx->dev->rdev); | 874 | c4iw_rdev_close(&ctx->dev->rdev); |
875 | WARN_ON_ONCE(!idr_is_empty(&ctx->dev->cqidr)); | ||
875 | idr_destroy(&ctx->dev->cqidr); | 876 | idr_destroy(&ctx->dev->cqidr); |
877 | WARN_ON_ONCE(!idr_is_empty(&ctx->dev->qpidr)); | ||
876 | idr_destroy(&ctx->dev->qpidr); | 878 | idr_destroy(&ctx->dev->qpidr); |
879 | WARN_ON_ONCE(!idr_is_empty(&ctx->dev->mmidr)); | ||
877 | idr_destroy(&ctx->dev->mmidr); | 880 | idr_destroy(&ctx->dev->mmidr); |
881 | wait_event(ctx->dev->wait, idr_is_empty(&ctx->dev->hwtid_idr)); | ||
878 | idr_destroy(&ctx->dev->hwtid_idr); | 882 | idr_destroy(&ctx->dev->hwtid_idr); |
879 | idr_destroy(&ctx->dev->stid_idr); | 883 | idr_destroy(&ctx->dev->stid_idr); |
880 | idr_destroy(&ctx->dev->atid_idr); | 884 | idr_destroy(&ctx->dev->atid_idr); |
@@ -992,6 +996,7 @@ static struct c4iw_dev *c4iw_alloc(const struct cxgb4_lld_info *infop) | |||
992 | mutex_init(&devp->rdev.stats.lock); | 996 | mutex_init(&devp->rdev.stats.lock); |
993 | mutex_init(&devp->db_mutex); | 997 | mutex_init(&devp->db_mutex); |
994 | INIT_LIST_HEAD(&devp->db_fc_list); | 998 | INIT_LIST_HEAD(&devp->db_fc_list); |
999 | init_waitqueue_head(&devp->wait); | ||
995 | devp->avail_ird = devp->rdev.lldi.max_ird_adapter; | 1000 | devp->avail_ird = devp->rdev.lldi.max_ird_adapter; |
996 | 1001 | ||
997 | if (c4iw_debugfs_root) { | 1002 | if (c4iw_debugfs_root) { |
diff --git a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h index aa47e0ae80bc..4b83b84f7ddf 100644 --- a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h +++ b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h | |||
@@ -263,6 +263,7 @@ struct c4iw_dev { | |||
263 | struct idr stid_idr; | 263 | struct idr stid_idr; |
264 | struct list_head db_fc_list; | 264 | struct list_head db_fc_list; |
265 | u32 avail_ird; | 265 | u32 avail_ird; |
266 | wait_queue_head_t wait; | ||
266 | }; | 267 | }; |
267 | 268 | ||
268 | static inline struct c4iw_dev *to_c4iw_dev(struct ib_device *ibdev) | 269 | static inline struct c4iw_dev *to_c4iw_dev(struct ib_device *ibdev) |
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 8dcf5a960951..60f7eab11865 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c | |||
@@ -1693,7 +1693,12 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown) | |||
1693 | nvme_suspend_queue(dev->queues[i]); | 1693 | nvme_suspend_queue(dev->queues[i]); |
1694 | 1694 | ||
1695 | if (csts & NVME_CSTS_CFS || !(csts & NVME_CSTS_RDY)) { | 1695 | if (csts & NVME_CSTS_CFS || !(csts & NVME_CSTS_RDY)) { |
1696 | nvme_suspend_queue(dev->queues[0]); | 1696 | /* A device might become IO incapable very soon during |
1697 | * probe, before the admin queue is configured. Thus, | ||
1698 | * queue_count can be 0 here. | ||
1699 | */ | ||
1700 | if (dev->queue_count) | ||
1701 | nvme_suspend_queue(dev->queues[0]); | ||
1697 | } else { | 1702 | } else { |
1698 | nvme_disable_io_queues(dev); | 1703 | nvme_disable_io_queues(dev); |
1699 | nvme_disable_admin_queue(dev, shutdown); | 1704 | nvme_disable_admin_queue(dev, shutdown); |
@@ -2112,6 +2117,8 @@ static const struct pci_device_id nvme_id_table[] = { | |||
2112 | .driver_data = NVME_QUIRK_IDENTIFY_CNS, }, | 2117 | .driver_data = NVME_QUIRK_IDENTIFY_CNS, }, |
2113 | { PCI_DEVICE(0x1c58, 0x0003), /* HGST adapter */ | 2118 | { PCI_DEVICE(0x1c58, 0x0003), /* HGST adapter */ |
2114 | .driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY, }, | 2119 | .driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY, }, |
2120 | { PCI_DEVICE(0x1c5f, 0x0540), /* Memblaze Pblaze4 adapter */ | ||
2121 | .driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY, }, | ||
2115 | { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) }, | 2122 | { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) }, |
2116 | { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001) }, | 2123 | { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001) }, |
2117 | { 0, } | 2124 | { 0, } |
diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index ab545fb347a0..c2c2c28e6eb5 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c | |||
@@ -82,6 +82,8 @@ struct nvme_rdma_request { | |||
82 | 82 | ||
83 | enum nvme_rdma_queue_flags { | 83 | enum nvme_rdma_queue_flags { |
84 | NVME_RDMA_Q_CONNECTED = (1 << 0), | 84 | NVME_RDMA_Q_CONNECTED = (1 << 0), |
85 | NVME_RDMA_IB_QUEUE_ALLOCATED = (1 << 1), | ||
86 | NVME_RDMA_Q_DELETING = (1 << 2), | ||
85 | }; | 87 | }; |
86 | 88 | ||
87 | struct nvme_rdma_queue { | 89 | struct nvme_rdma_queue { |
@@ -291,6 +293,7 @@ static int nvme_rdma_reinit_request(void *data, struct request *rq) | |||
291 | if (IS_ERR(req->mr)) { | 293 | if (IS_ERR(req->mr)) { |
292 | ret = PTR_ERR(req->mr); | 294 | ret = PTR_ERR(req->mr); |
293 | req->mr = NULL; | 295 | req->mr = NULL; |
296 | goto out; | ||
294 | } | 297 | } |
295 | 298 | ||
296 | req->mr->need_inval = false; | 299 | req->mr->need_inval = false; |
@@ -480,9 +483,14 @@ out_err: | |||
480 | 483 | ||
481 | static void nvme_rdma_destroy_queue_ib(struct nvme_rdma_queue *queue) | 484 | static void nvme_rdma_destroy_queue_ib(struct nvme_rdma_queue *queue) |
482 | { | 485 | { |
483 | struct nvme_rdma_device *dev = queue->device; | 486 | struct nvme_rdma_device *dev; |
484 | struct ib_device *ibdev = dev->dev; | 487 | struct ib_device *ibdev; |
488 | |||
489 | if (!test_and_clear_bit(NVME_RDMA_IB_QUEUE_ALLOCATED, &queue->flags)) | ||
490 | return; | ||
485 | 491 | ||
492 | dev = queue->device; | ||
493 | ibdev = dev->dev; | ||
486 | rdma_destroy_qp(queue->cm_id); | 494 | rdma_destroy_qp(queue->cm_id); |
487 | ib_free_cq(queue->ib_cq); | 495 | ib_free_cq(queue->ib_cq); |
488 | 496 | ||
@@ -533,6 +541,7 @@ static int nvme_rdma_create_queue_ib(struct nvme_rdma_queue *queue, | |||
533 | ret = -ENOMEM; | 541 | ret = -ENOMEM; |
534 | goto out_destroy_qp; | 542 | goto out_destroy_qp; |
535 | } | 543 | } |
544 | set_bit(NVME_RDMA_IB_QUEUE_ALLOCATED, &queue->flags); | ||
536 | 545 | ||
537 | return 0; | 546 | return 0; |
538 | 547 | ||
@@ -552,6 +561,7 @@ static int nvme_rdma_init_queue(struct nvme_rdma_ctrl *ctrl, | |||
552 | 561 | ||
553 | queue = &ctrl->queues[idx]; | 562 | queue = &ctrl->queues[idx]; |
554 | queue->ctrl = ctrl; | 563 | queue->ctrl = ctrl; |
564 | queue->flags = 0; | ||
555 | init_completion(&queue->cm_done); | 565 | init_completion(&queue->cm_done); |
556 | 566 | ||
557 | if (idx > 0) | 567 | if (idx > 0) |
@@ -590,6 +600,7 @@ static int nvme_rdma_init_queue(struct nvme_rdma_ctrl *ctrl, | |||
590 | return 0; | 600 | return 0; |
591 | 601 | ||
592 | out_destroy_cm_id: | 602 | out_destroy_cm_id: |
603 | nvme_rdma_destroy_queue_ib(queue); | ||
593 | rdma_destroy_id(queue->cm_id); | 604 | rdma_destroy_id(queue->cm_id); |
594 | return ret; | 605 | return ret; |
595 | } | 606 | } |
@@ -608,7 +619,7 @@ static void nvme_rdma_free_queue(struct nvme_rdma_queue *queue) | |||
608 | 619 | ||
609 | static void nvme_rdma_stop_and_free_queue(struct nvme_rdma_queue *queue) | 620 | static void nvme_rdma_stop_and_free_queue(struct nvme_rdma_queue *queue) |
610 | { | 621 | { |
611 | if (!test_and_clear_bit(NVME_RDMA_Q_CONNECTED, &queue->flags)) | 622 | if (test_and_set_bit(NVME_RDMA_Q_DELETING, &queue->flags)) |
612 | return; | 623 | return; |
613 | nvme_rdma_stop_queue(queue); | 624 | nvme_rdma_stop_queue(queue); |
614 | nvme_rdma_free_queue(queue); | 625 | nvme_rdma_free_queue(queue); |
@@ -652,7 +663,7 @@ static int nvme_rdma_init_io_queues(struct nvme_rdma_ctrl *ctrl) | |||
652 | return 0; | 663 | return 0; |
653 | 664 | ||
654 | out_free_queues: | 665 | out_free_queues: |
655 | for (; i >= 1; i--) | 666 | for (i--; i >= 1; i--) |
656 | nvme_rdma_stop_and_free_queue(&ctrl->queues[i]); | 667 | nvme_rdma_stop_and_free_queue(&ctrl->queues[i]); |
657 | 668 | ||
658 | return ret; | 669 | return ret; |
@@ -761,8 +772,13 @@ static void nvme_rdma_error_recovery_work(struct work_struct *work) | |||
761 | { | 772 | { |
762 | struct nvme_rdma_ctrl *ctrl = container_of(work, | 773 | struct nvme_rdma_ctrl *ctrl = container_of(work, |
763 | struct nvme_rdma_ctrl, err_work); | 774 | struct nvme_rdma_ctrl, err_work); |
775 | int i; | ||
764 | 776 | ||
765 | nvme_stop_keep_alive(&ctrl->ctrl); | 777 | nvme_stop_keep_alive(&ctrl->ctrl); |
778 | |||
779 | for (i = 0; i < ctrl->queue_count; i++) | ||
780 | clear_bit(NVME_RDMA_Q_CONNECTED, &ctrl->queues[i].flags); | ||
781 | |||
766 | if (ctrl->queue_count > 1) | 782 | if (ctrl->queue_count > 1) |
767 | nvme_stop_queues(&ctrl->ctrl); | 783 | nvme_stop_queues(&ctrl->ctrl); |
768 | blk_mq_stop_hw_queues(ctrl->ctrl.admin_q); | 784 | blk_mq_stop_hw_queues(ctrl->ctrl.admin_q); |
@@ -1305,58 +1321,6 @@ out_destroy_queue_ib: | |||
1305 | return ret; | 1321 | return ret; |
1306 | } | 1322 | } |
1307 | 1323 | ||
1308 | /** | ||
1309 | * nvme_rdma_device_unplug() - Handle RDMA device unplug | ||
1310 | * @queue: Queue that owns the cm_id that caught the event | ||
1311 | * | ||
1312 | * DEVICE_REMOVAL event notifies us that the RDMA device is about | ||
1313 | * to unplug so we should take care of destroying our RDMA resources. | ||
1314 | * This event will be generated for each allocated cm_id. | ||
1315 | * | ||
1316 | * In our case, the RDMA resources are managed per controller and not | ||
1317 | * only per queue. So the way we handle this is we trigger an implicit | ||
1318 | * controller deletion upon the first DEVICE_REMOVAL event we see, and | ||
1319 | * hold the event inflight until the controller deletion is completed. | ||
1320 | * | ||
1321 | * One exception that we need to handle is the destruction of the cm_id | ||
1322 | * that caught the event. Since we hold the callout until the controller | ||
1323 | * deletion is completed, we'll deadlock if the controller deletion will | ||
1324 | * call rdma_destroy_id on this queue's cm_id. Thus, we claim ownership | ||
1325 | * of destroying this queue before-hand, destroy the queue resources, | ||
1326 | * then queue the controller deletion which won't destroy this queue and | ||
1327 | * we destroy the cm_id implicitely by returning a non-zero rc to the callout. | ||
1328 | */ | ||
1329 | static int nvme_rdma_device_unplug(struct nvme_rdma_queue *queue) | ||
1330 | { | ||
1331 | struct nvme_rdma_ctrl *ctrl = queue->ctrl; | ||
1332 | int ret = 0; | ||
1333 | |||
1334 | /* Own the controller deletion */ | ||
1335 | if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_DELETING)) | ||
1336 | return 0; | ||
1337 | |||
1338 | dev_warn(ctrl->ctrl.device, | ||
1339 | "Got rdma device removal event, deleting ctrl\n"); | ||
1340 | |||
1341 | /* Get rid of reconnect work if its running */ | ||
1342 | cancel_delayed_work_sync(&ctrl->reconnect_work); | ||
1343 | |||
1344 | /* Disable the queue so ctrl delete won't free it */ | ||
1345 | if (test_and_clear_bit(NVME_RDMA_Q_CONNECTED, &queue->flags)) { | ||
1346 | /* Free this queue ourselves */ | ||
1347 | nvme_rdma_stop_queue(queue); | ||
1348 | nvme_rdma_destroy_queue_ib(queue); | ||
1349 | |||
1350 | /* Return non-zero so the cm_id will destroy implicitly */ | ||
1351 | ret = 1; | ||
1352 | } | ||
1353 | |||
1354 | /* Queue controller deletion */ | ||
1355 | queue_work(nvme_rdma_wq, &ctrl->delete_work); | ||
1356 | flush_work(&ctrl->delete_work); | ||
1357 | return ret; | ||
1358 | } | ||
1359 | |||
1360 | static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id, | 1324 | static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id, |
1361 | struct rdma_cm_event *ev) | 1325 | struct rdma_cm_event *ev) |
1362 | { | 1326 | { |
@@ -1398,8 +1362,8 @@ static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id, | |||
1398 | nvme_rdma_error_recovery(queue->ctrl); | 1362 | nvme_rdma_error_recovery(queue->ctrl); |
1399 | break; | 1363 | break; |
1400 | case RDMA_CM_EVENT_DEVICE_REMOVAL: | 1364 | case RDMA_CM_EVENT_DEVICE_REMOVAL: |
1401 | /* return 1 means impliciy CM ID destroy */ | 1365 | /* device removal is handled via the ib_client API */ |
1402 | return nvme_rdma_device_unplug(queue); | 1366 | break; |
1403 | default: | 1367 | default: |
1404 | dev_err(queue->ctrl->ctrl.device, | 1368 | dev_err(queue->ctrl->ctrl.device, |
1405 | "Unexpected RDMA CM event (%d)\n", ev->event); | 1369 | "Unexpected RDMA CM event (%d)\n", ev->event); |
@@ -1700,15 +1664,19 @@ static int __nvme_rdma_del_ctrl(struct nvme_rdma_ctrl *ctrl) | |||
1700 | static int nvme_rdma_del_ctrl(struct nvme_ctrl *nctrl) | 1664 | static int nvme_rdma_del_ctrl(struct nvme_ctrl *nctrl) |
1701 | { | 1665 | { |
1702 | struct nvme_rdma_ctrl *ctrl = to_rdma_ctrl(nctrl); | 1666 | struct nvme_rdma_ctrl *ctrl = to_rdma_ctrl(nctrl); |
1703 | int ret; | 1667 | int ret = 0; |
1704 | 1668 | ||
1669 | /* | ||
1670 | * Keep a reference until all work is flushed since | ||
1671 | * __nvme_rdma_del_ctrl can free the ctrl mem | ||
1672 | */ | ||
1673 | if (!kref_get_unless_zero(&ctrl->ctrl.kref)) | ||
1674 | return -EBUSY; | ||
1705 | ret = __nvme_rdma_del_ctrl(ctrl); | 1675 | ret = __nvme_rdma_del_ctrl(ctrl); |
1706 | if (ret) | 1676 | if (!ret) |
1707 | return ret; | 1677 | flush_work(&ctrl->delete_work); |
1708 | 1678 | nvme_put_ctrl(&ctrl->ctrl); | |
1709 | flush_work(&ctrl->delete_work); | 1679 | return ret; |
1710 | |||
1711 | return 0; | ||
1712 | } | 1680 | } |
1713 | 1681 | ||
1714 | static void nvme_rdma_remove_ctrl_work(struct work_struct *work) | 1682 | static void nvme_rdma_remove_ctrl_work(struct work_struct *work) |
@@ -2005,27 +1973,57 @@ static struct nvmf_transport_ops nvme_rdma_transport = { | |||
2005 | .create_ctrl = nvme_rdma_create_ctrl, | 1973 | .create_ctrl = nvme_rdma_create_ctrl, |
2006 | }; | 1974 | }; |
2007 | 1975 | ||
1976 | static void nvme_rdma_add_one(struct ib_device *ib_device) | ||
1977 | { | ||
1978 | } | ||
1979 | |||
1980 | static void nvme_rdma_remove_one(struct ib_device *ib_device, void *client_data) | ||
1981 | { | ||
1982 | struct nvme_rdma_ctrl *ctrl; | ||
1983 | |||
1984 | /* Delete all controllers using this device */ | ||
1985 | mutex_lock(&nvme_rdma_ctrl_mutex); | ||
1986 | list_for_each_entry(ctrl, &nvme_rdma_ctrl_list, list) { | ||
1987 | if (ctrl->device->dev != ib_device) | ||
1988 | continue; | ||
1989 | dev_info(ctrl->ctrl.device, | ||
1990 | "Removing ctrl: NQN \"%s\", addr %pISp\n", | ||
1991 | ctrl->ctrl.opts->subsysnqn, &ctrl->addr); | ||
1992 | __nvme_rdma_del_ctrl(ctrl); | ||
1993 | } | ||
1994 | mutex_unlock(&nvme_rdma_ctrl_mutex); | ||
1995 | |||
1996 | flush_workqueue(nvme_rdma_wq); | ||
1997 | } | ||
1998 | |||
1999 | static struct ib_client nvme_rdma_ib_client = { | ||
2000 | .name = "nvme_rdma", | ||
2001 | .add = nvme_rdma_add_one, | ||
2002 | .remove = nvme_rdma_remove_one | ||
2003 | }; | ||
2004 | |||
2008 | static int __init nvme_rdma_init_module(void) | 2005 | static int __init nvme_rdma_init_module(void) |
2009 | { | 2006 | { |
2007 | int ret; | ||
2008 | |||
2010 | nvme_rdma_wq = create_workqueue("nvme_rdma_wq"); | 2009 | nvme_rdma_wq = create_workqueue("nvme_rdma_wq"); |
2011 | if (!nvme_rdma_wq) | 2010 | if (!nvme_rdma_wq) |
2012 | return -ENOMEM; | 2011 | return -ENOMEM; |
2013 | 2012 | ||
2013 | ret = ib_register_client(&nvme_rdma_ib_client); | ||
2014 | if (ret) { | ||
2015 | destroy_workqueue(nvme_rdma_wq); | ||
2016 | return ret; | ||
2017 | } | ||
2018 | |||
2014 | nvmf_register_transport(&nvme_rdma_transport); | 2019 | nvmf_register_transport(&nvme_rdma_transport); |
2015 | return 0; | 2020 | return 0; |
2016 | } | 2021 | } |
2017 | 2022 | ||
2018 | static void __exit nvme_rdma_cleanup_module(void) | 2023 | static void __exit nvme_rdma_cleanup_module(void) |
2019 | { | 2024 | { |
2020 | struct nvme_rdma_ctrl *ctrl; | ||
2021 | |||
2022 | nvmf_unregister_transport(&nvme_rdma_transport); | 2025 | nvmf_unregister_transport(&nvme_rdma_transport); |
2023 | 2026 | ib_unregister_client(&nvme_rdma_ib_client); | |
2024 | mutex_lock(&nvme_rdma_ctrl_mutex); | ||
2025 | list_for_each_entry(ctrl, &nvme_rdma_ctrl_list, list) | ||
2026 | __nvme_rdma_del_ctrl(ctrl); | ||
2027 | mutex_unlock(&nvme_rdma_ctrl_mutex); | ||
2028 | |||
2029 | destroy_workqueue(nvme_rdma_wq); | 2027 | destroy_workqueue(nvme_rdma_wq); |
2030 | } | 2028 | } |
2031 | 2029 | ||