diff mbox

[08/34] target: Make core_tmr_abort_task() consider all commands

Message ID 20170125233646.2243-9-bart.vanassche@sandisk.com (mailing list archive)
State Superseded
Headers show

Commit Message

Bart Van Assche Jan. 25, 2017, 11:36 p.m. UTC
It is possible that two commands with the same tag are present on
sess_cmd_list because commands are removed from sess_cmd_list after
a response has been sent to the initiator. Hence continue searching
through sess_cmd_list even if a matching tag has already been found.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Himanshu Madhani <himanshu.madhani@cavium.com>
Cc: Giridhar Malavali <giridhar.malavali@cavium.com>
---
 drivers/target/target_core_tmr.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Hannes Reinecke Jan. 26, 2017, 7:48 a.m. UTC | #1
On 01/26/2017 12:36 AM, Bart Van Assche wrote:
> It is possible that two commands with the same tag are present on
> sess_cmd_list because commands are removed from sess_cmd_list after
> a response has been sent to the initiator. Hence continue searching
> through sess_cmd_list even if a matching tag has already been found.
> 
> Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Himanshu Madhani <himanshu.madhani@cavium.com>
> Cc: Giridhar Malavali <giridhar.malavali@cavium.com>
> ---
>  drivers/target/target_core_tmr.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
Which arguably is an error in itself; we should return the response
after all actions have been taken.

But anyway.

Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,
Christoph Hellwig Jan. 26, 2017, 5:26 p.m. UTC | #2
On Wed, Jan 25, 2017 at 03:36:20PM -0800, Bart Van Assche wrote:
> It is possible that two commands with the same tag are present on
> sess_cmd_list because commands are removed from sess_cmd_list after
> a response has been sent to the initiator. Hence continue searching
> through sess_cmd_list even if a matching tag has already been found.

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c
index 4f229e711e1c..311dc3c2f1dc 100644
--- a/drivers/target/target_core_tmr.c
+++ b/drivers/target/target_core_tmr.c
@@ -175,10 +175,9 @@  void core_tmr_abort_task(
 		printk("ABORT_TASK: Found referenced %s task_tag: %llu\n",
 			se_cmd->se_tfo->get_fabric_name(), ref_tag);
 
-		if (!__target_check_io_state(se_cmd, se_sess, 0)) {
-			spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags);
-			goto out;
-		}
+		if (!__target_check_io_state(se_cmd, se_sess, 0))
+			continue;
+
 		list_del_init(&se_cmd->se_cmd_list);
 		spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags);
 
@@ -195,7 +194,6 @@  void core_tmr_abort_task(
 	}
 	spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags);
 
-out:
 	printk("ABORT_TASK: Sending TMR_TASK_DOES_NOT_EXIST for ref_tag: %lld\n",
 			tmr->ref_task_tag);
 	tmr->response = TMR_TASK_DOES_NOT_EXIST;