Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scsi: qla2xxx: Make sure that aborted commands are freed

The LIO core requires that the target driver callback functions
.queue_data_in() and .queue_status() call target_put_sess_cmd() or
transport_generic_free_cmd(). These calls may happen synchronously or
asynchronously. Make sure that one of these LIO functions is called in case
a command has been aborted. This patch avoids that the code for removing a
session hangs due to commands that do not make progress.

Cc: Himanshu Madhani <hmadhani@marvell.com>
Fixes: 694833ee00c4 ("scsi: tcm_qla2xxx: Do not allow aborted cmd to advance.") # v4.13.
Fixes: a07100e00ac4 ("qla2xxx: Fix TMR ABORT interaction issue between qla2xxx and TCM") # v4.5.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Tested-by: Himanshu Madhani <hmadhani@marvell.com>
Reviewed-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Bart Van Assche and committed by
Martin K. Petersen
0dcec41a bcc85657

+12 -5
+8 -5
drivers/scsi/qla2xxx/qla_target.c
··· 3206 3206 if (!qpair->fw_started || (cmd->reset_count != qpair->chip_reset) || 3207 3207 (cmd->sess && cmd->sess->deleted)) { 3208 3208 cmd->state = QLA_TGT_STATE_PROCESSED; 3209 - return 0; 3209 + res = 0; 3210 + goto free; 3210 3211 } 3211 3212 3212 3213 ql_dbg_qp(ql_dbg_tgt, qpair, 0xe018, ··· 3218 3217 3219 3218 res = qlt_pre_xmit_response(cmd, &prm, xmit_type, scsi_status, 3220 3219 &full_req_cnt); 3221 - if (unlikely(res != 0)) { 3222 - return res; 3223 - } 3220 + if (unlikely(res != 0)) 3221 + goto free; 3224 3222 3225 3223 spin_lock_irqsave(qpair->qp_lock_ptr, flags); 3226 3224 ··· 3239 3239 vha->flags.online, qla2x00_reset_active(vha), 3240 3240 cmd->reset_count, qpair->chip_reset); 3241 3241 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); 3242 - return 0; 3242 + res = 0; 3243 + goto free; 3243 3244 } 3244 3245 3245 3246 /* Does F/W have an IOCBs for this request */ ··· 3343 3342 qlt_unmap_sg(vha, cmd); 3344 3343 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); 3345 3344 3345 + free: 3346 + vha->hw->tgt.tgt_ops->free_cmd(cmd); 3346 3347 return res; 3347 3348 } 3348 3349 EXPORT_SYMBOL(qlt_xmit_response);
+4
drivers/scsi/qla2xxx/tcm_qla2xxx.c
··· 620 620 { 621 621 struct qla_tgt_cmd *cmd = container_of(se_cmd, 622 622 struct qla_tgt_cmd, se_cmd); 623 + struct scsi_qla_host *vha = cmd->vha; 623 624 624 625 if (cmd->aborted) { 625 626 /* Cmd can loop during Q-full. tcm_qla2xxx_aborted_task ··· 633 632 cmd->se_cmd.transport_state, 634 633 cmd->se_cmd.t_state, 635 634 cmd->se_cmd.se_cmd_flags); 635 + vha->hw->tgt.tgt_ops->free_cmd(cmd); 636 636 return 0; 637 637 } 638 638 ··· 661 659 { 662 660 struct qla_tgt_cmd *cmd = container_of(se_cmd, 663 661 struct qla_tgt_cmd, se_cmd); 662 + struct scsi_qla_host *vha = cmd->vha; 664 663 int xmit_type = QLA_TGT_XMIT_STATUS; 665 664 666 665 if (cmd->aborted) { ··· 675 672 cmd, kref_read(&cmd->se_cmd.cmd_kref), 676 673 cmd->se_cmd.transport_state, cmd->se_cmd.t_state, 677 674 cmd->se_cmd.se_cmd_flags); 675 + vha->hw->tgt.tgt_ops->free_cmd(cmd); 678 676 return 0; 679 677 } 680 678 cmd->bufflen = se_cmd->data_length;