Skip to content

Commit

Permalink
target: Prevent transport_send_task_abort when CHECK_CONDITION status
Browse files Browse the repository at this point in the history
This patch fixes a bug where transport_send_task_abort() could be called
during LUN_RESET to return SAM_STAT_TASK_ABORTED + tfo->queue_status(), when
SCF_SENT_CHECK_CONDITION -> tfo->queue_status() has already been sent from
within another context via transport_send_check_condition_and_sense().

Cc: stable@kernel.org
Signed-off-by: Nicholas Bellinger <nab@risingtidesystems.com>
  • Loading branch information
Nicholas Bellinger committed Oct 24, 2011
1 parent 77039d1 commit c252f00
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/target/target_core_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -4919,6 +4919,15 @@ EXPORT_SYMBOL(transport_check_aborted_status);

void transport_send_task_abort(struct se_cmd *cmd)
{
unsigned long flags;

spin_lock_irqsave(&cmd->t_state_lock, flags);
if (cmd->se_cmd_flags & SCF_SENT_CHECK_CONDITION) {
spin_unlock_irqrestore(&cmd->t_state_lock, flags);
return;
}
spin_unlock_irqrestore(&cmd->t_state_lock, flags);

/*
* If there are still expected incoming fabric WRITEs, we wait
* until until they have completed before sending a TASK_ABORTED
Expand Down

0 comments on commit c252f00

Please sign in to comment.