diff mbox series

[24/25] target: flush submission work during TMR processing

Message ID 20210217202811.5575-25-michael.christie@oracle.com
State Superseded
Headers show
Series None | expand

Commit Message

Mike Christie Feb. 17, 2021, 8:28 p.m. UTC
If a cmd is on the submission workqueue then the TMR code will
miss it, and end up returning task not found or success for
lun resets. The fabric driver might then tell the initiator that
the running cmds have been handled when they are about to run.

This adds a flush when we are processing TMRs to make sure queued
cmds do not run after returning the TMR response.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
Tested-by: Laurence Oberman <loberman@redhat.com>
---
 drivers/target/target_core_tmr.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Bodo Stroesser Feb. 19, 2021, 7:46 p.m. UTC | #1
On 17.02.21 21:28, Mike Christie wrote:
> If a cmd is on the submission workqueue then the TMR code will

> miss it, and end up returning task not found or success for

> lun resets. The fabric driver might then tell the initiator that

> the running cmds have been handled when they are about to run.

> 

> This adds a flush when we are processing TMRs to make sure queued

> cmds do not run after returning the TMR response.

> 

> Signed-off-by: Mike Christie <michael.christie@oracle.com>

> Tested-by: Laurence Oberman <loberman@redhat.com>

> ---

>   drivers/target/target_core_tmr.c | 4 ++++

>   1 file changed, 4 insertions(+)

> 

> diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c

> index 7347285471fa..e7fcbc09f9db 100644

> --- a/drivers/target/target_core_tmr.c

> +++ b/drivers/target/target_core_tmr.c

> @@ -124,6 +124,8 @@ void core_tmr_abort_task(

>   	int i;

>   

>   	for (i = 0; i < dev->queue_cnt; i++) {

> +		flush_work(&dev->queues[i].sq.work);

> +

>   		spin_lock_irqsave(&dev->queues[i].lock, flags);

>   		list_for_each_entry_safe(se_cmd, next, &dev->queues[i].state_list,

>   					 state_list) {

> @@ -302,6 +304,8 @@ static void core_tmr_drain_state_list(

>   	 * in the Control Mode Page.

>   	 */

>   	for (i = 0; i < dev->queue_cnt; i++) {

> +		flush_work(&dev->queues[i].sq.work);

> +

>   		spin_lock_irqsave(&dev->queues[i].lock, flags);

>   		list_for_each_entry_safe(cmd, next, &dev->queues[i].state_list,

>   					 state_list) {

> 


Looks good.

Reviewed-by: Bodo Stroesser <bostroesser@gmail.com>
diff mbox series

Patch

diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c
index 7347285471fa..e7fcbc09f9db 100644
--- a/drivers/target/target_core_tmr.c
+++ b/drivers/target/target_core_tmr.c
@@ -124,6 +124,8 @@  void core_tmr_abort_task(
 	int i;
 
 	for (i = 0; i < dev->queue_cnt; i++) {
+		flush_work(&dev->queues[i].sq.work);
+
 		spin_lock_irqsave(&dev->queues[i].lock, flags);
 		list_for_each_entry_safe(se_cmd, next, &dev->queues[i].state_list,
 					 state_list) {
@@ -302,6 +304,8 @@  static void core_tmr_drain_state_list(
 	 * in the Control Mode Page.
 	 */
 	for (i = 0; i < dev->queue_cnt; i++) {
+		flush_work(&dev->queues[i].sq.work);
+
 		spin_lock_irqsave(&dev->queues[i].lock, flags);
 		list_for_each_entry_safe(cmd, next, &dev->queues[i].state_list,
 					 state_list) {