Skip to content

Commit

Permalink
target: Use complete_all for se_cmd->t_transport_stop_comp
Browse files Browse the repository at this point in the history
This patch fixes a bug where multiple waiters on ->t_transport_stop_comp
occurs due to a concurrent ABORT_TASK and session reset both invoking
transport_wait_for_tasks(), while waiting for the associated se_cmd
descriptor backend processing to complete.

For this case, complete_all() should be invoked in order to wake up
both waiters in core_tmr_abort_task() + transport_generic_free_cmd()
process contexts.

Cc: Thomas Glanzmann <thomas@glanzmann.de>
Cc: Charalampos Pournaris <charpour@gmail.com>
Cc: stable@vger.kernel.org # 3.10+
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
  • Loading branch information
Nicholas Bellinger committed Jun 10, 2014
1 parent f15e9cd commit a95d651
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/target/target_core_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ static int transport_cmd_check_stop(struct se_cmd *cmd, bool remove_from_lists,

spin_unlock_irqrestore(&cmd->t_state_lock, flags);

complete(&cmd->t_transport_stop_comp);
complete_all(&cmd->t_transport_stop_comp);
return 1;
}

Expand Down Expand Up @@ -687,7 +687,7 @@ void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status)
if (cmd->transport_state & CMD_T_ABORTED &&
cmd->transport_state & CMD_T_STOP) {
spin_unlock_irqrestore(&cmd->t_state_lock, flags);
complete(&cmd->t_transport_stop_comp);
complete_all(&cmd->t_transport_stop_comp);
return;
} else if (!success) {
INIT_WORK(&cmd->work, target_complete_failure_work);
Expand Down Expand Up @@ -1761,7 +1761,7 @@ void target_execute_cmd(struct se_cmd *cmd)
cmd->se_tfo->get_task_tag(cmd));

spin_unlock_irq(&cmd->t_state_lock);
complete(&cmd->t_transport_stop_comp);
complete_all(&cmd->t_transport_stop_comp);
return;
}

Expand Down

0 comments on commit a95d651

Please sign in to comment.