Every .aborted_task() call is followed by a call to .release_cmd(). Instead of letting tcm_qla2xxx_aborted_task() figure out the command state, wait until the target core calls tcm_qla2xxx_release_cmd() and free resources from within that function. Signed-off-by: Bart Van Assche <bart.vanassche@xxxxxxxxxxx> Cc: Himanshu Madhani <himanshu.madhani@xxxxxxxxxx> Cc: Quinn Tran <quinn.tran@xxxxxxxxxx> Cc: Hannes Reinecke <hare@xxxxxxxx> Cc: Christoph Hellwig <hch@xxxxxx> Cc: Andy Grover <agrover@xxxxxxxxxx> Cc: David Disseldorp <ddiss@xxxxxxx> --- drivers/scsi/qla2xxx/qla_target.h | 1 - drivers/scsi/qla2xxx/tcm_qla2xxx.c | 22 +--------------------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h index d1a039f1ad97..f4c8dc9f3402 100644 --- a/drivers/scsi/qla2xxx/qla_target.h +++ b/drivers/scsi/qla2xxx/qla_target.h @@ -878,7 +878,6 @@ struct qla_tgt_cmd { unsigned int cmd_in_wq:1; unsigned int aborted:1; unsigned int data_work:1; - unsigned int data_work_free:1; struct scatterlist *sg; /* cmd data buffer SG vector */ int sg_cnt; /* SG segments count */ diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 25ca44f2fb40..22fedbd55166 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c @@ -493,7 +493,6 @@ static void tcm_qla2xxx_handle_data_work(struct work_struct *work) spin_lock_irqsave(&cmd->cmd_lock, flags); cmd->data_work = 1; if (cmd->aborted) { - cmd->data_work_free = 1; spin_unlock_irqrestore(&cmd->cmd_lock, flags); tcm_qla2xxx_free_cmd(cmd); @@ -734,31 +733,12 @@ static void tcm_qla2xxx_queue_tm_rsp(struct se_cmd *se_cmd) transport_generic_free_cmd(&mcmd->se_cmd, 0); } -#define DATA_WORK_NOT_FREE(_cmd) (_cmd->data_work && !_cmd->data_work_free) static void tcm_qla2xxx_aborted_task(struct se_cmd *se_cmd) { struct qla_tgt_cmd *cmd = container_of(se_cmd, struct qla_tgt_cmd, se_cmd); - unsigned long flags; - - if (qlt_abort_cmd(cmd)) - return; - - spin_lock_irqsave(&cmd->cmd_lock, flags); - if ((cmd->state == QLA_TGT_STATE_NEW)|| - ((cmd->state == QLA_TGT_STATE_DATA_IN) && - DATA_WORK_NOT_FREE(cmd))) { - cmd->data_work_free = 1; - spin_unlock_irqrestore(&cmd->cmd_lock, flags); - /* - * cmd has not reached fw, Use this trigger to free it. - */ - tcm_qla2xxx_free_cmd(cmd); - return; - } - spin_unlock_irqrestore(&cmd->cmd_lock, flags); - return; + WARN_ON_ONCE(qlt_abort_cmd(cmd) != 0); } static void tcm_qla2xxx_clear_sess_lookup(struct tcm_qla2xxx_lport *, -- 2.12.2 -- 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