diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-09-20 13:41:38 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-09-20 13:41:38 -0400 |
| commit | 0d9514334bb00355206d17d50474d2613656113f (patch) | |
| tree | 916524d9918af02c7ffc3d8ca0d49705fa418163 | |
| parent | 1734a6e47fbad93f896644ad8ad12574fadba49d (diff) | |
| parent | 8ae757d09c45102b347a1bc2867f54ffc1ab8fda (diff) | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
Pull SCSI target fixes from Nicholas Bellinger:
"Here are the target pending fixes for v3.17-rc6.
Included are Sagi's long overdue fixes related to iser-target
shutdown, along with a couple of fixes from Sebastian related to ALUA
Referrals changes that when in during the v3.14 time-frame.
Also included are a few iscsi-target fixes, most recently of which
where found during Joern's Coverity scanning of target code"
* git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending:
iscsi-target: avoid NULL pointer in iscsi_copy_param_list failure
iscsi-target: Fix memory corruption in iscsit_logout_post_handler_diffcid
target: Fix inverted logic in SE_DEV_ALUA_SUPPORT_STATE_STORE
target: Fix user data segment multiplier in spc_emulate_evpd_b3()
iscsi-target: Ignore ICF_GOT_LAST_DATAOUT during Data-Out ITT lookup
Target/iser: Fix initiator_depth and responder_resources
Target/iser: Avoid calling rdma_disconnect twice
Target/iser: Don't put isert_conn inside disconnected handler
Target/iser: Get isert_conn reference once got to connected_handler
| -rw-r--r-- | drivers/infiniband/ulp/isert/ib_isert.c | 20 | ||||
| -rw-r--r-- | drivers/target/iscsi/iscsi_target.c | 4 | ||||
| -rw-r--r-- | drivers/target/iscsi/iscsi_target_parameters.c | 2 | ||||
| -rw-r--r-- | drivers/target/iscsi/iscsi_target_util.c | 2 | ||||
| -rw-r--r-- | drivers/target/target_core_configfs.c | 2 | ||||
| -rw-r--r-- | drivers/target/target_core_spc.c | 2 |
6 files changed, 19 insertions, 13 deletions
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index d4c7928a0f36..da8ff124762a 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c | |||
| @@ -586,17 +586,12 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) | |||
| 586 | init_completion(&isert_conn->conn_wait); | 586 | init_completion(&isert_conn->conn_wait); |
| 587 | init_completion(&isert_conn->conn_wait_comp_err); | 587 | init_completion(&isert_conn->conn_wait_comp_err); |
| 588 | kref_init(&isert_conn->conn_kref); | 588 | kref_init(&isert_conn->conn_kref); |
| 589 | kref_get(&isert_conn->conn_kref); | ||
| 590 | mutex_init(&isert_conn->conn_mutex); | 589 | mutex_init(&isert_conn->conn_mutex); |
| 591 | spin_lock_init(&isert_conn->conn_lock); | 590 | spin_lock_init(&isert_conn->conn_lock); |
| 592 | INIT_LIST_HEAD(&isert_conn->conn_fr_pool); | 591 | INIT_LIST_HEAD(&isert_conn->conn_fr_pool); |
| 593 | 592 | ||
| 594 | cma_id->context = isert_conn; | 593 | cma_id->context = isert_conn; |
| 595 | isert_conn->conn_cm_id = cma_id; | 594 | isert_conn->conn_cm_id = cma_id; |
| 596 | isert_conn->responder_resources = event->param.conn.responder_resources; | ||
| 597 | isert_conn->initiator_depth = event->param.conn.initiator_depth; | ||
| 598 | pr_debug("Using responder_resources: %u initiator_depth: %u\n", | ||
| 599 | isert_conn->responder_resources, isert_conn->initiator_depth); | ||
| 600 | 595 | ||
| 601 | isert_conn->login_buf = kzalloc(ISCSI_DEF_MAX_RECV_SEG_LEN + | 596 | isert_conn->login_buf = kzalloc(ISCSI_DEF_MAX_RECV_SEG_LEN + |
| 602 | ISER_RX_LOGIN_SIZE, GFP_KERNEL); | 597 | ISER_RX_LOGIN_SIZE, GFP_KERNEL); |
| @@ -643,6 +638,12 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) | |||
| 643 | goto out_rsp_dma_map; | 638 | goto out_rsp_dma_map; |
| 644 | } | 639 | } |
| 645 | 640 | ||
| 641 | /* Set max inflight RDMA READ requests */ | ||
| 642 | isert_conn->initiator_depth = min_t(u8, | ||
| 643 | event->param.conn.initiator_depth, | ||
| 644 | device->dev_attr.max_qp_init_rd_atom); | ||
| 645 | pr_debug("Using initiator_depth: %u\n", isert_conn->initiator_depth); | ||
| 646 | |||
| 646 | isert_conn->conn_device = device; | 647 | isert_conn->conn_device = device; |
| 647 | isert_conn->conn_pd = ib_alloc_pd(isert_conn->conn_device->ib_device); | 648 | isert_conn->conn_pd = ib_alloc_pd(isert_conn->conn_device->ib_device); |
| 648 | if (IS_ERR(isert_conn->conn_pd)) { | 649 | if (IS_ERR(isert_conn->conn_pd)) { |
| @@ -746,7 +747,9 @@ isert_connect_release(struct isert_conn *isert_conn) | |||
| 746 | static void | 747 | static void |
| 747 | isert_connected_handler(struct rdma_cm_id *cma_id) | 748 | isert_connected_handler(struct rdma_cm_id *cma_id) |
| 748 | { | 749 | { |
| 749 | return; | 750 | struct isert_conn *isert_conn = cma_id->context; |
| 751 | |||
| 752 | kref_get(&isert_conn->conn_kref); | ||
| 750 | } | 753 | } |
| 751 | 754 | ||
| 752 | static void | 755 | static void |
| @@ -798,7 +801,6 @@ isert_disconnect_work(struct work_struct *work) | |||
| 798 | 801 | ||
| 799 | wake_up: | 802 | wake_up: |
| 800 | complete(&isert_conn->conn_wait); | 803 | complete(&isert_conn->conn_wait); |
| 801 | isert_put_conn(isert_conn); | ||
| 802 | } | 804 | } |
| 803 | 805 | ||
| 804 | static void | 806 | static void |
| @@ -3067,7 +3069,6 @@ isert_rdma_accept(struct isert_conn *isert_conn) | |||
| 3067 | int ret; | 3069 | int ret; |
| 3068 | 3070 | ||
| 3069 | memset(&cp, 0, sizeof(struct rdma_conn_param)); | 3071 | memset(&cp, 0, sizeof(struct rdma_conn_param)); |
| 3070 | cp.responder_resources = isert_conn->responder_resources; | ||
| 3071 | cp.initiator_depth = isert_conn->initiator_depth; | 3072 | cp.initiator_depth = isert_conn->initiator_depth; |
| 3072 | cp.retry_count = 7; | 3073 | cp.retry_count = 7; |
| 3073 | cp.rnr_retry_count = 7; | 3074 | cp.rnr_retry_count = 7; |
| @@ -3215,7 +3216,7 @@ static void isert_wait_conn(struct iscsi_conn *conn) | |||
| 3215 | pr_debug("isert_wait_conn: Starting \n"); | 3216 | pr_debug("isert_wait_conn: Starting \n"); |
| 3216 | 3217 | ||
| 3217 | mutex_lock(&isert_conn->conn_mutex); | 3218 | mutex_lock(&isert_conn->conn_mutex); |
| 3218 | if (isert_conn->conn_cm_id) { | 3219 | if (isert_conn->conn_cm_id && !isert_conn->disconnect) { |
| 3219 | pr_debug("Calling rdma_disconnect from isert_wait_conn\n"); | 3220 | pr_debug("Calling rdma_disconnect from isert_wait_conn\n"); |
| 3220 | rdma_disconnect(isert_conn->conn_cm_id); | 3221 | rdma_disconnect(isert_conn->conn_cm_id); |
| 3221 | } | 3222 | } |
| @@ -3234,6 +3235,7 @@ static void isert_wait_conn(struct iscsi_conn *conn) | |||
| 3234 | wait_for_completion(&isert_conn->conn_wait_comp_err); | 3235 | wait_for_completion(&isert_conn->conn_wait_comp_err); |
| 3235 | 3236 | ||
| 3236 | wait_for_completion(&isert_conn->conn_wait); | 3237 | wait_for_completion(&isert_conn->conn_wait); |
| 3238 | isert_put_conn(isert_conn); | ||
| 3237 | } | 3239 | } |
| 3238 | 3240 | ||
| 3239 | static void isert_free_conn(struct iscsi_conn *conn) | 3241 | static void isert_free_conn(struct iscsi_conn *conn) |
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 1f4c794f5fcc..260c3e1e312c 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
| @@ -4540,6 +4540,7 @@ static void iscsit_logout_post_handler_diffcid( | |||
| 4540 | { | 4540 | { |
| 4541 | struct iscsi_conn *l_conn; | 4541 | struct iscsi_conn *l_conn; |
| 4542 | struct iscsi_session *sess = conn->sess; | 4542 | struct iscsi_session *sess = conn->sess; |
| 4543 | bool conn_found = false; | ||
| 4543 | 4544 | ||
| 4544 | if (!sess) | 4545 | if (!sess) |
| 4545 | return; | 4546 | return; |
| @@ -4548,12 +4549,13 @@ static void iscsit_logout_post_handler_diffcid( | |||
| 4548 | list_for_each_entry(l_conn, &sess->sess_conn_list, conn_list) { | 4549 | list_for_each_entry(l_conn, &sess->sess_conn_list, conn_list) { |
| 4549 | if (l_conn->cid == cid) { | 4550 | if (l_conn->cid == cid) { |
| 4550 | iscsit_inc_conn_usage_count(l_conn); | 4551 | iscsit_inc_conn_usage_count(l_conn); |
| 4552 | conn_found = true; | ||
| 4551 | break; | 4553 | break; |
| 4552 | } | 4554 | } |
| 4553 | } | 4555 | } |
| 4554 | spin_unlock_bh(&sess->conn_lock); | 4556 | spin_unlock_bh(&sess->conn_lock); |
| 4555 | 4557 | ||
| 4556 | if (!l_conn) | 4558 | if (!conn_found) |
| 4557 | return; | 4559 | return; |
| 4558 | 4560 | ||
| 4559 | if (l_conn->sock) | 4561 | if (l_conn->sock) |
diff --git a/drivers/target/iscsi/iscsi_target_parameters.c b/drivers/target/iscsi/iscsi_target_parameters.c index 02f9de26f38a..18c29260b4a2 100644 --- a/drivers/target/iscsi/iscsi_target_parameters.c +++ b/drivers/target/iscsi/iscsi_target_parameters.c | |||
| @@ -601,7 +601,7 @@ int iscsi_copy_param_list( | |||
| 601 | param_list = kzalloc(sizeof(struct iscsi_param_list), GFP_KERNEL); | 601 | param_list = kzalloc(sizeof(struct iscsi_param_list), GFP_KERNEL); |
| 602 | if (!param_list) { | 602 | if (!param_list) { |
| 603 | pr_err("Unable to allocate memory for struct iscsi_param_list.\n"); | 603 | pr_err("Unable to allocate memory for struct iscsi_param_list.\n"); |
| 604 | goto err_out; | 604 | return -1; |
| 605 | } | 605 | } |
| 606 | INIT_LIST_HEAD(¶m_list->param_list); | 606 | INIT_LIST_HEAD(¶m_list->param_list); |
| 607 | INIT_LIST_HEAD(¶m_list->extra_response_list); | 607 | INIT_LIST_HEAD(¶m_list->extra_response_list); |
diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c index fd90b28f1d94..73355f4fca74 100644 --- a/drivers/target/iscsi/iscsi_target_util.c +++ b/drivers/target/iscsi/iscsi_target_util.c | |||
| @@ -400,6 +400,8 @@ struct iscsi_cmd *iscsit_find_cmd_from_itt_or_dump( | |||
| 400 | 400 | ||
| 401 | spin_lock_bh(&conn->cmd_lock); | 401 | spin_lock_bh(&conn->cmd_lock); |
| 402 | list_for_each_entry(cmd, &conn->conn_cmd_list, i_conn_node) { | 402 | list_for_each_entry(cmd, &conn->conn_cmd_list, i_conn_node) { |
| 403 | if (cmd->cmd_flags & ICF_GOT_LAST_DATAOUT) | ||
| 404 | continue; | ||
| 403 | if (cmd->init_task_tag == init_task_tag) { | 405 | if (cmd->init_task_tag == init_task_tag) { |
| 404 | spin_unlock_bh(&conn->cmd_lock); | 406 | spin_unlock_bh(&conn->cmd_lock); |
| 405 | return cmd; | 407 | return cmd; |
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index bf55c5a04cfa..756def38c77a 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c | |||
| @@ -2363,7 +2363,7 @@ static ssize_t target_core_alua_tg_pt_gp_store_attr_alua_support_##_name(\ | |||
| 2363 | pr_err("Invalid value '%ld', must be '0' or '1'\n", tmp); \ | 2363 | pr_err("Invalid value '%ld', must be '0' or '1'\n", tmp); \ |
| 2364 | return -EINVAL; \ | 2364 | return -EINVAL; \ |
| 2365 | } \ | 2365 | } \ |
| 2366 | if (!tmp) \ | 2366 | if (tmp) \ |
| 2367 | t->_var |= _bit; \ | 2367 | t->_var |= _bit; \ |
| 2368 | else \ | 2368 | else \ |
| 2369 | t->_var &= ~_bit; \ | 2369 | t->_var &= ~_bit; \ |
diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c index 6cd7222738fc..bc286a67af7c 100644 --- a/drivers/target/target_core_spc.c +++ b/drivers/target/target_core_spc.c | |||
| @@ -664,7 +664,7 @@ spc_emulate_evpd_b3(struct se_cmd *cmd, unsigned char *buf) | |||
| 664 | buf[0] = dev->transport->get_device_type(dev); | 664 | buf[0] = dev->transport->get_device_type(dev); |
| 665 | buf[3] = 0x0c; | 665 | buf[3] = 0x0c; |
| 666 | put_unaligned_be32(dev->t10_alua.lba_map_segment_size, &buf[8]); | 666 | put_unaligned_be32(dev->t10_alua.lba_map_segment_size, &buf[8]); |
| 667 | put_unaligned_be32(dev->t10_alua.lba_map_segment_size, &buf[12]); | 667 | put_unaligned_be32(dev->t10_alua.lba_map_segment_multiplier, &buf[12]); |
| 668 | 668 | ||
| 669 | return 0; | 669 | return 0; |
| 670 | } | 670 | } |
