This prepares for getting the target core out of irq context. Signed-off-by: Christoph Hellwig <hch@xxxxxx> Index: lio-core/drivers/scsi/qla2xxx/qla_target.c =================================================================== --- lio-core.orig/drivers/scsi/qla2xxx/qla_target.c 2011-11-07 08:23:38.590819434 +0100 +++ lio-core/drivers/scsi/qla2xxx/qla_target.c 2011-11-07 09:48:20.709816700 +0100 @@ -3111,7 +3111,6 @@ static int qla_tgt_handle_cmd_for_atio(s { struct qla_hw_data *ha = vha->hw; struct qla_tgt *tgt = ha->qla_tgt; - struct qla_tgt_sess *sess; struct qla_tgt_cmd *cmd; int res = 0; @@ -3137,43 +3136,6 @@ static int qla_tgt_handle_cmd_for_atio(s cmd->tgt = ha->qla_tgt; cmd->vha = vha; - if (IS_FWI2_CAPABLE(ha)) { - sess = ha->tgt_ops->find_sess_by_s_id(vha, atio->u.isp24.fcp_hdr.s_id); - if (unlikely(!sess)) { - ql_dbg(ql_dbg_tgt_mgt, vha, 0xe125, "qla_target(%d): Unable to find " - "wwn login (s_id %x:%x:%x), trying to create " - "it manually\n", vha->vp_idx, - atio->u.isp24.fcp_hdr.s_id[0], - atio->u.isp24.fcp_hdr.s_id[1], - atio->u.isp24.fcp_hdr.s_id[2]); - goto out_sched; - } - } else { - sess = ha->tgt_ops->find_sess_by_loop_id(vha, - GET_TARGET_ID(ha, atio)); - if (unlikely(!sess)) { - ql_dbg(ql_dbg_tgt_mgt, vha, 0xe126, "qla_target(%d): Unable to find " - "wwn login (loop_id=%d), trying to create it " - "manually\n", vha->vp_idx, - GET_TARGET_ID(ha, atio)); - goto out_sched; - } - } - - if (sess->tearing_down || tgt->tgt_stop) - goto out_free_cmd; - - res = qla_tgt_send_cmd_to_target(vha, cmd, sess); - if (unlikely(res != 0)) - goto out_free_cmd; - - return res; - -out_free_cmd: - qla_tgt_free_cmd(cmd); - return res; - -out_sched: if (atio->entry_count > 1) { ql_dbg(ql_dbg_tgt_mgt, vha, 0xe127, "Dropping multy entry cmd %p\n", cmd); res = -EBUSY; @@ -3183,6 +3145,11 @@ out_sched: INIT_WORK(&cmd->work, qla_tgt_exec_cmd_work); schedule_work(&cmd->work); return 0; + +out_free_cmd: + qla_tgt_free_cmd(cmd); + return res; + } /* ha->hardware_lock supposed to be held on entry */ @@ -4585,7 +4552,7 @@ static void qla_tgt_exec_cmd_work(struct goto out_term; } - if (tgt->tgt_stop) + if (sess->tearing_down || tgt->tgt_stop) goto out_term; if (tgt->tm_to_unknown) { -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html