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

target: Fix delayed Task Aborted Status (TAS) handling bug

This patch fixes a bug in delayed Task Aborted Status (TAS) handling,
where transport_send_task_abort() was not returning for the case
when the se_tfo->write_pending() callback indicated that last fabric
specific WRITE PDU had not yet been received.

It also adds an explicit cmd->scsi_status = SAM_STAT_TASK_ABORTED
assignment within transport_check_aborted_status() to avoid the case
where se_tfo->queue_status() is called when the SAM_STAT_TASK_ABORTED
assignment + ->queue_status() in transport_send_task_abort() does not
occur once SCF_SENT_DELAYED_TAS has been set.

Cc: <stable@vger.kernel.org> #3.2+
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>

+2
+2
drivers/target/target_core_transport.c
··· 2682 2682 cmd->t_task_cdb[0], cmd->se_tfo->get_task_tag(cmd)); 2683 2683 2684 2684 cmd->se_cmd_flags |= SCF_SENT_DELAYED_TAS; 2685 + cmd->scsi_status = SAM_STAT_TASK_ABORTED; 2685 2686 trace_target_cmd_complete(cmd); 2686 2687 cmd->se_tfo->queue_status(cmd); 2687 2688 ··· 2711 2710 if (cmd->se_tfo->write_pending_status(cmd) != 0) { 2712 2711 cmd->transport_state |= CMD_T_ABORTED; 2713 2712 smp_mb__after_atomic_inc(); 2713 + return; 2714 2714 } 2715 2715 } 2716 2716 cmd->scsi_status = SAM_STAT_TASK_ABORTED;