aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/tcm_qla2xxx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/qla2xxx/tcm_qla2xxx.c')
-rw-r--r--drivers/scsi/qla2xxx/tcm_qla2xxx.c55
1 files changed, 20 insertions, 35 deletions
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
index 6e64314dbbb3..4752f65a9272 100644
--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
+++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
@@ -38,8 +38,6 @@
38#include <linux/string.h> 38#include <linux/string.h>
39#include <linux/configfs.h> 39#include <linux/configfs.h>
40#include <linux/ctype.h> 40#include <linux/ctype.h>
41#include <linux/string.h>
42#include <linux/ctype.h>
43#include <asm/unaligned.h> 41#include <asm/unaligned.h>
44#include <scsi/scsi.h> 42#include <scsi/scsi.h>
45#include <scsi/scsi_host.h> 43#include <scsi/scsi_host.h>
@@ -466,8 +464,7 @@ static int tcm_qla2xxx_shutdown_session(struct se_session *se_sess)
466 vha = sess->vha; 464 vha = sess->vha;
467 465
468 spin_lock_irqsave(&vha->hw->hardware_lock, flags); 466 spin_lock_irqsave(&vha->hw->hardware_lock, flags);
469 sess->tearing_down = 1; 467 target_sess_cmd_list_set_waiting(se_sess);
470 target_splice_sess_cmd_list(se_sess);
471 spin_unlock_irqrestore(&vha->hw->hardware_lock, flags); 468 spin_unlock_irqrestore(&vha->hw->hardware_lock, flags);
472 469
473 return 1; 470 return 1;
@@ -600,28 +597,15 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd,
600 return -EINVAL; 597 return -EINVAL;
601 } 598 }
602 599
603 target_submit_cmd(se_cmd, se_sess, cdb, &cmd->sense_buffer[0], 600 return target_submit_cmd(se_cmd, se_sess, cdb, &cmd->sense_buffer[0],
604 cmd->unpacked_lun, data_length, fcp_task_attr, 601 cmd->unpacked_lun, data_length, fcp_task_attr,
605 data_dir, flags); 602 data_dir, flags);
606 return 0;
607} 603}
608 604
609static void tcm_qla2xxx_do_rsp(struct work_struct *work) 605static void tcm_qla2xxx_handle_data_work(struct work_struct *work)
610{ 606{
611 struct qla_tgt_cmd *cmd = container_of(work, struct qla_tgt_cmd, work); 607 struct qla_tgt_cmd *cmd = container_of(work, struct qla_tgt_cmd, work);
612 /*
613 * Dispatch ->queue_status from workqueue process context
614 */
615 transport_generic_request_failure(&cmd->se_cmd);
616}
617 608
618/*
619 * Called from qla_target.c:qlt_do_ctio_completion()
620 */
621static int tcm_qla2xxx_handle_data(struct qla_tgt_cmd *cmd)
622{
623 struct se_cmd *se_cmd = &cmd->se_cmd;
624 unsigned long flags;
625 /* 609 /*
626 * Ensure that the complete FCP WRITE payload has been received. 610 * Ensure that the complete FCP WRITE payload has been received.
627 * Otherwise return an exception via CHECK_CONDITION status. 611 * Otherwise return an exception via CHECK_CONDITION status.
@@ -631,24 +615,26 @@ static int tcm_qla2xxx_handle_data(struct qla_tgt_cmd *cmd)
631 * Check if se_cmd has already been aborted via LUN_RESET, and 615 * Check if se_cmd has already been aborted via LUN_RESET, and
632 * waiting upon completion in tcm_qla2xxx_write_pending_status() 616 * waiting upon completion in tcm_qla2xxx_write_pending_status()
633 */ 617 */
634 spin_lock_irqsave(&se_cmd->t_state_lock, flags); 618 if (cmd->se_cmd.transport_state & CMD_T_ABORTED) {
635 if (se_cmd->transport_state & CMD_T_ABORTED) { 619 complete(&cmd->se_cmd.t_transport_stop_comp);
636 spin_unlock_irqrestore(&se_cmd->t_state_lock, flags); 620 return;
637 complete(&se_cmd->t_transport_stop_comp);
638 return 0;
639 } 621 }
640 spin_unlock_irqrestore(&se_cmd->t_state_lock, flags);
641 622
642 se_cmd->scsi_sense_reason = TCM_CHECK_CONDITION_ABORT_CMD; 623 cmd->se_cmd.scsi_sense_reason = TCM_CHECK_CONDITION_ABORT_CMD;
643 INIT_WORK(&cmd->work, tcm_qla2xxx_do_rsp); 624 transport_generic_request_failure(&cmd->se_cmd);
644 queue_work(tcm_qla2xxx_free_wq, &cmd->work); 625 return;
645 return 0;
646 } 626 }
647 /* 627
648 * We now tell TCM to queue this WRITE CDB with TRANSPORT_PROCESS_WRITE 628 return target_execute_cmd(&cmd->se_cmd);
649 * status to the backstore processing thread. 629}
650 */ 630
651 return transport_generic_handle_data(&cmd->se_cmd); 631/*
632 * Called from qla_target.c:qlt_do_ctio_completion()
633 */
634static void tcm_qla2xxx_handle_data(struct qla_tgt_cmd *cmd)
635{
636 INIT_WORK(&cmd->work, tcm_qla2xxx_handle_data_work);
637 queue_work(tcm_qla2xxx_free_wq, &cmd->work);
652} 638}
653 639
654/* 640/*
@@ -1690,7 +1676,6 @@ static struct target_core_fabric_ops tcm_qla2xxx_ops = {
1690 .tpg_alloc_fabric_acl = tcm_qla2xxx_alloc_fabric_acl, 1676 .tpg_alloc_fabric_acl = tcm_qla2xxx_alloc_fabric_acl,
1691 .tpg_release_fabric_acl = tcm_qla2xxx_release_fabric_acl, 1677 .tpg_release_fabric_acl = tcm_qla2xxx_release_fabric_acl,
1692 .tpg_get_inst_index = tcm_qla2xxx_tpg_get_inst_index, 1678 .tpg_get_inst_index = tcm_qla2xxx_tpg_get_inst_index,
1693 .new_cmd_map = NULL,
1694 .check_stop_free = tcm_qla2xxx_check_stop_free, 1679 .check_stop_free = tcm_qla2xxx_check_stop_free,
1695 .release_cmd = tcm_qla2xxx_release_cmd, 1680 .release_cmd = tcm_qla2xxx_release_cmd,
1696 .put_session = tcm_qla2xxx_put_session, 1681 .put_session = tcm_qla2xxx_put_session,