aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-11 15:57:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-11 15:57:19 -0400
commit6d2fa9e141ea56a571ec842fd4f3a86bea44a203 (patch)
treee419f95b7d080046f0f4d4d5041b42a0889f2f0a /drivers/scsi
parent0fb3767b0a5601dd0d528bc8dbefc0567a34b7ec (diff)
parentca40d24eb8fc3c194b4439493ecf6b2d703812b8 (diff)
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
Pull SCSI target updates from Nicholas Bellinger: "Lots of activity this round on performance improvements in target-core while benchmarking the prototype scsi-mq initiator code with vhost-scsi fabric ports, along with a number of iscsi/iser-target improvements and hardening fixes for exception path cases post v3.10 merge. The highlights include: - Make persistent reservations APTPL buffer allocated on-demand, and drop per t10_reservation buffer. (grover) - Make virtual LUN=0 a NULLIO device, and skip allocation of NULLIO device pages (grover) - Add transport_cmd_check_stop write_pending bit to avoid extra access of ->t_state_lock is WRITE I/O submission fast-path. (nab) - Drop unnecessary CMD_T_DEV_ACTIVE check from transport_lun_remove_cmd to avoid extra access of ->t_state_lock in release fast-path. (nab) - Avoid extra t_state_lock access in __target_execute_cmd fast-path (nab) - Drop unnecessary vhost-scsi wait_for_tasks=true usage + ->t_state_lock access in release fast-path. (nab) - Convert vhost-scsi to use modern se_cmd->cmd_kref TARGET_SCF_ACK_KREF usage (nab) - Add tracepoints for SCSI commands being processed (roland) - Refactoring of iscsi-target handling of ISCSI_OP_NOOP + ISCSI_OP_TEXT to be transport independent (nab) - Add iscsi-target SendTargets=$IQN support for in-band discovery (nab) - Add iser-target support for in-band discovery (nab + Or) - Add iscsi-target demo-mode TPG authentication context support (nab) - Fix isert_put_reject payload buffer post (nab) - Fix iscsit_add_reject* usage for iser (nab) - Fix iscsit_sequence_cmd reject handling for iser (nab) - Fix ISCSI_OP_SCSI_TMFUNC handling for iser (nab) - Fix session reset bug with RDMA_CM_EVENT_DISCONNECTED (nab) The last five iscsi/iser-target items are CC'ed to stable, as they do address issues present in v3.10 code. They are certainly larger than I'd like for stable patch set, but are important to ensure proper REJECT exception handling in iser-target for 3.10.y" * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (51 commits) iser-target: Ignore non TEXT + LOGOUT opcodes for discovery target: make queue_tm_rsp() return void target: remove unused codes from enum tcm_tmrsp_table iscsi-target: kstrtou* configfs attribute parameter cleanups iscsi-target: Fix tfc_tpg_auth_cit configfs length overflow iscsi-target: Fix tfc_tpg_nacl_auth_cit configfs length overflow iser-target: Add support for ISCSI_OP_TEXT opcode + payload handling iser-target: Rename sense_buf_[dma,len] to pdu_[dma,len] iser-target: Add vendor_err debug output target: Add (obsolete) checking for PMI/LBA fields in READ CAPACITY(10) target: Return correct sense data for IO past the end of a device target: Add tracepoints for SCSI commands being processed iser-target: Fix session reset bug with RDMA_CM_EVENT_DISCONNECTED iscsi-target: Fix ISCSI_OP_SCSI_TMFUNC handling for iser iscsi-target: Fix iscsit_sequence_cmd reject handling for iser iscsi-target: Fix iscsit_add_reject* usage for iser iser-target: Fix isert_put_reject payload buffer post iscsi-target: missing kfree() on error path iscsi-target: Drop left-over iscsi_conn->bad_hdr target: Make core_scsi3_update_and_write_aptpl return sense_reason_t ...
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/qla2xxx/qla_target.c151
-rw-r--r--drivers/scsi/qla2xxx/tcm_qla2xxx.c10
2 files changed, 18 insertions, 143 deletions
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index fcdc22306cab..83a8f7a9ec76 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -544,102 +544,6 @@ out_free_id_list:
544 return res; 544 return res;
545} 545}
546 546
547static bool qlt_check_fcport_exist(struct scsi_qla_host *vha,
548 struct qla_tgt_sess *sess)
549{
550 struct qla_hw_data *ha = vha->hw;
551 struct qla_port_24xx_data *pmap24;
552 bool res, found = false;
553 int rc, i;
554 uint16_t loop_id = 0xFFFF; /* to eliminate compiler's warning */
555 uint16_t entries;
556 void *pmap;
557 int pmap_len;
558 fc_port_t *fcport;
559 int global_resets;
560 unsigned long flags;
561
562retry:
563 global_resets = atomic_read(&ha->tgt.qla_tgt->tgt_global_resets_count);
564
565 rc = qla2x00_get_node_name_list(vha, &pmap, &pmap_len);
566 if (rc != QLA_SUCCESS) {
567 res = false;
568 goto out;
569 }
570
571 pmap24 = pmap;
572 entries = pmap_len/sizeof(*pmap24);
573
574 for (i = 0; i < entries; ++i) {
575 if (!memcmp(sess->port_name, pmap24[i].port_name, WWN_SIZE)) {
576 loop_id = le16_to_cpu(pmap24[i].loop_id);
577 found = true;
578 break;
579 }
580 }
581
582 kfree(pmap);
583
584 if (!found) {
585 res = false;
586 goto out;
587 }
588
589 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf046,
590 "qlt_check_fcport_exist(): loop_id %d", loop_id);
591
592 fcport = kzalloc(sizeof(*fcport), GFP_KERNEL);
593 if (fcport == NULL) {
594 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf047,
595 "qla_target(%d): Allocation of tmp FC port failed",
596 vha->vp_idx);
597 res = false;
598 goto out;
599 }
600
601 fcport->loop_id = loop_id;
602
603 rc = qla2x00_get_port_database(vha, fcport, 0);
604 if (rc != QLA_SUCCESS) {
605 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf048,
606 "qla_target(%d): Failed to retrieve fcport "
607 "information -- get_port_database() returned %x "
608 "(loop_id=0x%04x)", vha->vp_idx, rc, loop_id);
609 res = false;
610 goto out_free_fcport;
611 }
612
613 if (global_resets !=
614 atomic_read(&ha->tgt.qla_tgt->tgt_global_resets_count)) {
615 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf002,
616 "qla_target(%d): global reset during session discovery"
617 " (counter was %d, new %d), retrying",
618 vha->vp_idx, global_resets,
619 atomic_read(&ha->tgt.qla_tgt->tgt_global_resets_count));
620 goto retry;
621 }
622
623 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf003,
624 "Updating sess %p s_id %x:%x:%x, loop_id %d) to d_id %x:%x:%x, "
625 "loop_id %d", sess, sess->s_id.b.domain, sess->s_id.b.al_pa,
626 sess->s_id.b.area, sess->loop_id, fcport->d_id.b.domain,
627 fcport->d_id.b.al_pa, fcport->d_id.b.area, fcport->loop_id);
628
629 spin_lock_irqsave(&ha->hardware_lock, flags);
630 ha->tgt.tgt_ops->update_sess(sess, fcport->d_id, fcport->loop_id,
631 (fcport->flags & FCF_CONF_COMP_SUPPORTED));
632 spin_unlock_irqrestore(&ha->hardware_lock, flags);
633
634 res = true;
635
636out_free_fcport:
637 kfree(fcport);
638
639out:
640 return res;
641}
642
643/* ha->hardware_lock supposed to be held on entry */ 547/* ha->hardware_lock supposed to be held on entry */
644static void qlt_undelete_sess(struct qla_tgt_sess *sess) 548static void qlt_undelete_sess(struct qla_tgt_sess *sess)
645{ 549{
@@ -663,43 +567,13 @@ static void qlt_del_sess_work_fn(struct delayed_work *work)
663 sess = list_entry(tgt->del_sess_list.next, typeof(*sess), 567 sess = list_entry(tgt->del_sess_list.next, typeof(*sess),
664 del_list_entry); 568 del_list_entry);
665 if (time_after_eq(jiffies, sess->expires)) { 569 if (time_after_eq(jiffies, sess->expires)) {
666 bool cancel;
667
668 qlt_undelete_sess(sess); 570 qlt_undelete_sess(sess);
669 571
670 spin_unlock_irqrestore(&ha->hardware_lock, flags); 572 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf004,
671 cancel = qlt_check_fcport_exist(vha, sess); 573 "Timeout: sess %p about to be deleted\n",
672 574 sess);
673 if (cancel) { 575 ha->tgt.tgt_ops->shutdown_sess(sess);
674 if (sess->deleted) { 576 ha->tgt.tgt_ops->put_sess(sess);
675 /*
676 * sess was again deleted while we were
677 * discovering it
678 */
679 spin_lock_irqsave(&ha->hardware_lock,
680 flags);
681 continue;
682 }
683
684 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf049,
685 "qla_target(%d): cancel deletion of "
686 "session for port %02x:%02x:%02x:%02x:%02x:"
687 "%02x:%02x:%02x (loop ID %d), because "
688 " it isn't deleted by firmware",
689 vha->vp_idx, sess->port_name[0],
690 sess->port_name[1], sess->port_name[2],
691 sess->port_name[3], sess->port_name[4],
692 sess->port_name[5], sess->port_name[6],
693 sess->port_name[7], sess->loop_id);
694 } else {
695 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf004,
696 "Timeout: sess %p about to be deleted\n",
697 sess);
698 ha->tgt.tgt_ops->shutdown_sess(sess);
699 ha->tgt.tgt_ops->put_sess(sess);
700 }
701
702 spin_lock_irqsave(&ha->hardware_lock, flags);
703 } else { 577 } else {
704 schedule_delayed_work(&tgt->sess_del_work, 578 schedule_delayed_work(&tgt->sess_del_work,
705 jiffies - sess->expires); 579 jiffies - sess->expires);
@@ -884,9 +758,8 @@ void qlt_fc_port_added(struct scsi_qla_host *vha, fc_port_t *fcport)
884 sess->loop_id); 758 sess->loop_id);
885 sess->local = 0; 759 sess->local = 0;
886 } 760 }
887 spin_unlock_irqrestore(&ha->hardware_lock, flags);
888
889 ha->tgt.tgt_ops->put_sess(sess); 761 ha->tgt.tgt_ops->put_sess(sess);
762 spin_unlock_irqrestore(&ha->hardware_lock, flags);
890} 763}
891 764
892void qlt_fc_port_deleted(struct scsi_qla_host *vha, fc_port_t *fcport) 765void qlt_fc_port_deleted(struct scsi_qla_host *vha, fc_port_t *fcport)
@@ -2706,7 +2579,9 @@ static void qlt_do_work(struct work_struct *work)
2706 /* 2579 /*
2707 * Drop extra session reference from qla_tgt_handle_cmd_for_atio*( 2580 * Drop extra session reference from qla_tgt_handle_cmd_for_atio*(
2708 */ 2581 */
2582 spin_lock_irqsave(&ha->hardware_lock, flags);
2709 ha->tgt.tgt_ops->put_sess(sess); 2583 ha->tgt.tgt_ops->put_sess(sess);
2584 spin_unlock_irqrestore(&ha->hardware_lock, flags);
2710 return; 2585 return;
2711 2586
2712out_term: 2587out_term:
@@ -2718,9 +2593,9 @@ out_term:
2718 spin_lock_irqsave(&ha->hardware_lock, flags); 2593 spin_lock_irqsave(&ha->hardware_lock, flags);
2719 qlt_send_term_exchange(vha, NULL, &cmd->atio, 1); 2594 qlt_send_term_exchange(vha, NULL, &cmd->atio, 1);
2720 kmem_cache_free(qla_tgt_cmd_cachep, cmd); 2595 kmem_cache_free(qla_tgt_cmd_cachep, cmd);
2721 spin_unlock_irqrestore(&ha->hardware_lock, flags);
2722 if (sess) 2596 if (sess)
2723 ha->tgt.tgt_ops->put_sess(sess); 2597 ha->tgt.tgt_ops->put_sess(sess);
2598 spin_unlock_irqrestore(&ha->hardware_lock, flags);
2724} 2599}
2725 2600
2726/* ha->hardware_lock supposed to be held on entry */ 2601/* ha->hardware_lock supposed to be held on entry */
@@ -4169,16 +4044,16 @@ static void qlt_abort_work(struct qla_tgt *tgt,
4169 rc = __qlt_24xx_handle_abts(vha, &prm->abts, sess); 4044 rc = __qlt_24xx_handle_abts(vha, &prm->abts, sess);
4170 if (rc != 0) 4045 if (rc != 0)
4171 goto out_term; 4046 goto out_term;
4172 spin_unlock_irqrestore(&ha->hardware_lock, flags);
4173 4047
4174 ha->tgt.tgt_ops->put_sess(sess); 4048 ha->tgt.tgt_ops->put_sess(sess);
4049 spin_unlock_irqrestore(&ha->hardware_lock, flags);
4175 return; 4050 return;
4176 4051
4177out_term: 4052out_term:
4178 qlt_24xx_send_abts_resp(vha, &prm->abts, FCP_TMF_REJECTED, false); 4053 qlt_24xx_send_abts_resp(vha, &prm->abts, FCP_TMF_REJECTED, false);
4179 spin_unlock_irqrestore(&ha->hardware_lock, flags);
4180 if (sess) 4054 if (sess)
4181 ha->tgt.tgt_ops->put_sess(sess); 4055 ha->tgt.tgt_ops->put_sess(sess);
4056 spin_unlock_irqrestore(&ha->hardware_lock, flags);
4182} 4057}
4183 4058
4184static void qlt_tmr_work(struct qla_tgt *tgt, 4059static void qlt_tmr_work(struct qla_tgt *tgt,
@@ -4226,16 +4101,16 @@ static void qlt_tmr_work(struct qla_tgt *tgt,
4226 rc = qlt_issue_task_mgmt(sess, unpacked_lun, fn, iocb, 0); 4101 rc = qlt_issue_task_mgmt(sess, unpacked_lun, fn, iocb, 0);
4227 if (rc != 0) 4102 if (rc != 0)
4228 goto out_term; 4103 goto out_term;
4229 spin_unlock_irqrestore(&ha->hardware_lock, flags);
4230 4104
4231 ha->tgt.tgt_ops->put_sess(sess); 4105 ha->tgt.tgt_ops->put_sess(sess);
4106 spin_unlock_irqrestore(&ha->hardware_lock, flags);
4232 return; 4107 return;
4233 4108
4234out_term: 4109out_term:
4235 qlt_send_term_exchange(vha, NULL, &prm->tm_iocb2, 1); 4110 qlt_send_term_exchange(vha, NULL, &prm->tm_iocb2, 1);
4236 spin_unlock_irqrestore(&ha->hardware_lock, flags);
4237 if (sess) 4111 if (sess)
4238 ha->tgt.tgt_ops->put_sess(sess); 4112 ha->tgt.tgt_ops->put_sess(sess);
4113 spin_unlock_irqrestore(&ha->hardware_lock, flags);
4239} 4114}
4240 4115
4241static void qlt_sess_work_fn(struct work_struct *work) 4116static void qlt_sess_work_fn(struct work_struct *work)
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
index 66b0b26a1381..a318092e033f 100644
--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
+++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
@@ -703,7 +703,7 @@ static int tcm_qla2xxx_queue_status(struct se_cmd *se_cmd)
703 return qlt_xmit_response(cmd, xmit_type, se_cmd->scsi_status); 703 return qlt_xmit_response(cmd, xmit_type, se_cmd->scsi_status);
704} 704}
705 705
706static int tcm_qla2xxx_queue_tm_rsp(struct se_cmd *se_cmd) 706static void tcm_qla2xxx_queue_tm_rsp(struct se_cmd *se_cmd)
707{ 707{
708 struct se_tmr_req *se_tmr = se_cmd->se_tmr_req; 708 struct se_tmr_req *se_tmr = se_cmd->se_tmr_req;
709 struct qla_tgt_mgmt_cmd *mcmd = container_of(se_cmd, 709 struct qla_tgt_mgmt_cmd *mcmd = container_of(se_cmd,
@@ -735,8 +735,6 @@ static int tcm_qla2xxx_queue_tm_rsp(struct se_cmd *se_cmd)
735 * CTIO response packet. 735 * CTIO response packet.
736 */ 736 */
737 qlt_xmit_tm_rsp(mcmd); 737 qlt_xmit_tm_rsp(mcmd);
738
739 return 0;
740} 738}
741 739
742/* Local pointer to allocated TCM configfs fabric module */ 740/* Local pointer to allocated TCM configfs fabric module */
@@ -799,12 +797,14 @@ static void tcm_qla2xxx_put_session(struct se_session *se_sess)
799 797
800static void tcm_qla2xxx_put_sess(struct qla_tgt_sess *sess) 798static void tcm_qla2xxx_put_sess(struct qla_tgt_sess *sess)
801{ 799{
802 tcm_qla2xxx_put_session(sess->se_sess); 800 assert_spin_locked(&sess->vha->hw->hardware_lock);
801 kref_put(&sess->se_sess->sess_kref, tcm_qla2xxx_release_session);
803} 802}
804 803
805static void tcm_qla2xxx_shutdown_sess(struct qla_tgt_sess *sess) 804static void tcm_qla2xxx_shutdown_sess(struct qla_tgt_sess *sess)
806{ 805{
807 tcm_qla2xxx_shutdown_session(sess->se_sess); 806 assert_spin_locked(&sess->vha->hw->hardware_lock);
807 target_sess_cmd_list_set_waiting(sess->se_sess);
808} 808}
809 809
810static struct se_node_acl *tcm_qla2xxx_make_nodeacl( 810static struct se_node_acl *tcm_qla2xxx_make_nodeacl(