diff options
Diffstat (limited to 'drivers/infiniband/ulp/iser/iser_verbs.c')
-rw-r--r-- | drivers/infiniband/ulp/iser/iser_verbs.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c index 695a2704bd43..4065abe28829 100644 --- a/drivers/infiniband/ulp/iser/iser_verbs.c +++ b/drivers/infiniband/ulp/iser/iser_verbs.c | |||
@@ -600,16 +600,16 @@ void iser_release_work(struct work_struct *work) | |||
600 | /** | 600 | /** |
601 | * iser_free_ib_conn_res - release IB related resources | 601 | * iser_free_ib_conn_res - release IB related resources |
602 | * @iser_conn: iser connection struct | 602 | * @iser_conn: iser connection struct |
603 | * @destroy_device: indicator if we need to try to release | 603 | * @destroy: indicator if we need to try to release the |
604 | * the iser device (only iscsi shutdown and DEVICE_REMOVAL | 604 | * iser device and memory regoins pool (only iscsi |
605 | * will use this. | 605 | * shutdown and DEVICE_REMOVAL will use this). |
606 | * | 606 | * |
607 | * This routine is called with the iser state mutex held | 607 | * This routine is called with the iser state mutex held |
608 | * so the cm_id removal is out of here. It is Safe to | 608 | * so the cm_id removal is out of here. It is Safe to |
609 | * be invoked multiple times. | 609 | * be invoked multiple times. |
610 | */ | 610 | */ |
611 | static void iser_free_ib_conn_res(struct iser_conn *iser_conn, | 611 | static void iser_free_ib_conn_res(struct iser_conn *iser_conn, |
612 | bool destroy_device) | 612 | bool destroy) |
613 | { | 613 | { |
614 | struct ib_conn *ib_conn = &iser_conn->ib_conn; | 614 | struct ib_conn *ib_conn = &iser_conn->ib_conn; |
615 | struct iser_device *device = ib_conn->device; | 615 | struct iser_device *device = ib_conn->device; |
@@ -617,17 +617,20 @@ static void iser_free_ib_conn_res(struct iser_conn *iser_conn, | |||
617 | iser_info("freeing conn %p cma_id %p qp %p\n", | 617 | iser_info("freeing conn %p cma_id %p qp %p\n", |
618 | iser_conn, ib_conn->cma_id, ib_conn->qp); | 618 | iser_conn, ib_conn->cma_id, ib_conn->qp); |
619 | 619 | ||
620 | iser_free_rx_descriptors(iser_conn); | ||
621 | |||
622 | if (ib_conn->qp != NULL) { | 620 | if (ib_conn->qp != NULL) { |
623 | ib_conn->comp->active_qps--; | 621 | ib_conn->comp->active_qps--; |
624 | rdma_destroy_qp(ib_conn->cma_id); | 622 | rdma_destroy_qp(ib_conn->cma_id); |
625 | ib_conn->qp = NULL; | 623 | ib_conn->qp = NULL; |
626 | } | 624 | } |
627 | 625 | ||
628 | if (destroy_device && device != NULL) { | 626 | if (destroy) { |
629 | iser_device_try_release(device); | 627 | if (iser_conn->rx_descs) |
630 | ib_conn->device = NULL; | 628 | iser_free_rx_descriptors(iser_conn); |
629 | |||
630 | if (device != NULL) { | ||
631 | iser_device_try_release(device); | ||
632 | ib_conn->device = NULL; | ||
633 | } | ||
631 | } | 634 | } |
632 | } | 635 | } |
633 | 636 | ||
@@ -643,9 +646,11 @@ void iser_conn_release(struct iser_conn *iser_conn) | |||
643 | mutex_unlock(&ig.connlist_mutex); | 646 | mutex_unlock(&ig.connlist_mutex); |
644 | 647 | ||
645 | mutex_lock(&iser_conn->state_mutex); | 648 | mutex_lock(&iser_conn->state_mutex); |
649 | /* In case we endup here without ep_disconnect being invoked. */ | ||
646 | if (iser_conn->state != ISER_CONN_DOWN) { | 650 | if (iser_conn->state != ISER_CONN_DOWN) { |
647 | iser_warn("iser conn %p state %d, expected state down.\n", | 651 | iser_warn("iser conn %p state %d, expected state down.\n", |
648 | iser_conn, iser_conn->state); | 652 | iser_conn, iser_conn->state); |
653 | iscsi_destroy_endpoint(iser_conn->ep); | ||
649 | iser_conn->state = ISER_CONN_DOWN; | 654 | iser_conn->state = ISER_CONN_DOWN; |
650 | } | 655 | } |
651 | /* | 656 | /* |
@@ -840,7 +845,7 @@ static void iser_disconnected_handler(struct rdma_cm_id *cma_id) | |||
840 | } | 845 | } |
841 | 846 | ||
842 | static void iser_cleanup_handler(struct rdma_cm_id *cma_id, | 847 | static void iser_cleanup_handler(struct rdma_cm_id *cma_id, |
843 | bool destroy_device) | 848 | bool destroy) |
844 | { | 849 | { |
845 | struct iser_conn *iser_conn = (struct iser_conn *)cma_id->context; | 850 | struct iser_conn *iser_conn = (struct iser_conn *)cma_id->context; |
846 | 851 | ||
@@ -850,7 +855,7 @@ static void iser_cleanup_handler(struct rdma_cm_id *cma_id, | |||
850 | * and flush errors. | 855 | * and flush errors. |
851 | */ | 856 | */ |
852 | iser_disconnected_handler(cma_id); | 857 | iser_disconnected_handler(cma_id); |
853 | iser_free_ib_conn_res(iser_conn, destroy_device); | 858 | iser_free_ib_conn_res(iser_conn, destroy); |
854 | complete(&iser_conn->ib_completion); | 859 | complete(&iser_conn->ib_completion); |
855 | }; | 860 | }; |
856 | 861 | ||