summaryrefslogtreecommitdiff
path: root/drivers/target/target_core_tmr.c
diff options
context:
space:
mode:
authorBodo Stroesser <bstroesser@ts.fujitsu.com>2020-07-26 18:35:03 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2020-07-29 05:25:25 +0300
commitf5e2714ad1a62d23cd8e8af07d438912d8115fae (patch)
treeb951157ebf684e69426a2c57489b0badd7fb4b4b /drivers/target/target_core_tmr.c
parentdf2de6f2862984b55e93931faf7b481a7b98396d (diff)
downloadlinux-f5e2714ad1a62d23cd8e8af07d438912d8115fae.tar.xz
scsi: target: Modify core_tmr_abort_task()
This patch modifies core_tmr_abort_task() to use same looping and locking scheme as core_tmr_drain_state_list() does. This frees the state_list element in se_cmd for later use by tmr notification handling. Note: __target_check_io_state() now is called with param 0 instead of dev->dev_attrib.emulate_tas, because tas is not relevant since we always get ABRT on same session like the aborted command. Link: https://lore.kernel.org/r/20200726153510.13077-2-bstroesser@ts.fujitsu.com Reviewed-by: Mike Christie <michael.christie@oracle.com> Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/target/target_core_tmr.c')
-rw-r--r--drivers/target/target_core_tmr.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c
index 89c84d472cd7..73c4155f3c1e 100644
--- a/drivers/target/target_core_tmr.c
+++ b/drivers/target/target_core_tmr.c
@@ -116,14 +116,15 @@ void core_tmr_abort_task(
struct se_tmr_req *tmr,
struct se_session *se_sess)
{
- struct se_cmd *se_cmd;
+ struct se_cmd *se_cmd, *next;
unsigned long flags;
+ bool rc;
u64 ref_tag;
- spin_lock_irqsave(&se_sess->sess_cmd_lock, flags);
- list_for_each_entry(se_cmd, &se_sess->sess_cmd_list, se_cmd_list) {
+ spin_lock_irqsave(&dev->execute_task_lock, flags);
+ list_for_each_entry_safe(se_cmd, next, &dev->state_list, state_list) {
- if (dev != se_cmd->se_dev)
+ if (se_sess != se_cmd->se_sess)
continue;
/* skip task management functions, including tmr->task_cmd */
@@ -137,11 +138,16 @@ void core_tmr_abort_task(
printk("ABORT_TASK: Found referenced %s task_tag: %llu\n",
se_cmd->se_tfo->fabric_name, ref_tag);
- if (!__target_check_io_state(se_cmd, se_sess,
- dev->dev_attrib.emulate_tas))
+ spin_lock(&se_sess->sess_cmd_lock);
+ rc = __target_check_io_state(se_cmd, se_sess, 0);
+ spin_unlock(&se_sess->sess_cmd_lock);
+ if (!rc)
continue;
- spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags);
+ list_del_init(&se_cmd->state_list);
+ se_cmd->state_active = false;
+
+ spin_unlock_irqrestore(&dev->execute_task_lock, flags);
/*
* Ensure that this ABORT request is visible to the LU RESET
@@ -159,7 +165,7 @@ void core_tmr_abort_task(
atomic_long_inc(&dev->aborts_complete);
return;
}
- spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags);
+ spin_unlock_irqrestore(&dev->execute_task_lock, flags);
printk("ABORT_TASK: Sending TMR_TASK_DOES_NOT_EXIST for ref_tag: %lld\n",
tmr->ref_task_tag);