@@ -1891,6 +1891,11 @@ __qla2x00_abort_all_cmds(struct qla_qpair *qp, int res)
}
cmd = (struct qla_tgt_cmd *)sp;
cmd->aborted = 1;
+ cmd->trc_flags |= TRC_CTIO_ABORTED;
+ cmd->cmd_sent_to_fw = 0;
+ qlt_unmap_sg(vha, cmd);
+ ha->tgt.tgt_ops->free_cmd(cmd);
+
break;
case TYPE_TGT_TMCMD:
/* Skip task management functions. */
@@ -542,6 +542,11 @@ static void qla2x00_async_nack_sp_done(srb_t *sp, int res)
"Async done-%s res %x %8phC type %d\n",
sp->name, res, sp->fcport->port_name, sp->type);
+ if (!vha->hw->base_qpair) {
+ kref_put(&sp->cmd_kref, qla2x00_sp_release);
+ return;
+ }
+
spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags);
sp->fcport->flags &= ~FCF_ASYNC_SENT;
sp->fcport->chip_reset = vha->hw->base_qpair->chip_reset;
@@ -2477,7 +2482,7 @@ static int qlt_pci_map_calc_cnt(struct qla_tgt_prm *prm)
return -1;
}
-static void qlt_unmap_sg(struct scsi_qla_host *vha, struct qla_tgt_cmd *cmd)
+void qlt_unmap_sg(struct scsi_qla_host *vha, struct qla_tgt_cmd *cmd)
{
struct qla_hw_data *ha;
struct qla_qpair *qpair;
@@ -3246,6 +3251,7 @@ int qlt_xmit_response(struct qla_tgt_cmd *cmd, int xmit_type,
uint8_t scsi_status)
{
struct scsi_qla_host *vha = cmd->vha;
+ struct qla_hw_data *ha = vha->hw;
struct qla_qpair *qpair = cmd->qpair;
struct ctio7_to_24xx *pkt;
struct qla_tgt_prm prm;
@@ -3256,6 +3262,8 @@ int qlt_xmit_response(struct qla_tgt_cmd *cmd, int xmit_type,
if (!qpair->fw_started || (cmd->reset_count != qpair->chip_reset) ||
(cmd->sess && cmd->sess->deleted)) {
cmd->state = QLA_TGT_STATE_PROCESSED;
+ qlt_unmap_sg(vha, cmd);
+ ha->tgt.tgt_ops->free_cmd(cmd);
return 0;
}
@@ -1059,6 +1059,7 @@ extern int qlt_abort_cmd(struct qla_tgt_cmd *);
extern void qlt_xmit_tm_rsp(struct qla_tgt_mgmt_cmd *);
extern void qlt_free_mcmd(struct qla_tgt_mgmt_cmd *);
extern void qlt_free_cmd(struct qla_tgt_cmd *cmd);
+extern void qlt_unmap_sg(struct scsi_qla_host *vha, struct qla_tgt_cmd *cmd);
extern void qlt_async_event(uint16_t, struct scsi_qla_host *, uint16_t *);
extern void qlt_enable_vha(struct scsi_qla_host *);
extern void qlt_vport_create(struct scsi_qla_host *, struct qla_hw_data *);