diff options
-rw-r--r-- | drivers/target/target_core_tmr.c | 2 | ||||
-rw-r--r-- | drivers/target/target_core_transport.c | 41 | ||||
-rw-r--r-- | include/target/target_core_base.h | 2 |
3 files changed, 22 insertions, 23 deletions
diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index fc9d74890319..b4c9bb783c46 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c | |||
@@ -221,7 +221,7 @@ static void core_tmr_drain_task_list( | |||
221 | continue; | 221 | continue; |
222 | 222 | ||
223 | list_move_tail(&task->t_state_list, &drain_task_list); | 223 | list_move_tail(&task->t_state_list, &drain_task_list); |
224 | atomic_set(&task->task_state_active, 0); | 224 | task->t_state_active = false; |
225 | /* | 225 | /* |
226 | * Remove from task execute list before processing drain_task_list | 226 | * Remove from task execute list before processing drain_task_list |
227 | */ | 227 | */ |
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index ae112ac91c47..511836eb2953 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -421,18 +421,18 @@ static void transport_all_task_dev_remove_state(struct se_cmd *cmd) | |||
421 | if (task->task_flags & TF_ACTIVE) | 421 | if (task->task_flags & TF_ACTIVE) |
422 | continue; | 422 | continue; |
423 | 423 | ||
424 | if (!atomic_read(&task->task_state_active)) | ||
425 | continue; | ||
426 | |||
427 | spin_lock_irqsave(&dev->execute_task_lock, flags); | 424 | spin_lock_irqsave(&dev->execute_task_lock, flags); |
428 | list_del(&task->t_state_list); | 425 | if (task->t_state_active) { |
429 | pr_debug("Removed ITT: 0x%08x dev: %p task[%p]\n", | 426 | pr_debug("Removed ITT: 0x%08x dev: %p task[%p]\n", |
430 | cmd->se_tfo->get_task_tag(cmd), dev, task); | 427 | cmd->se_tfo->get_task_tag(cmd), dev, task); |
431 | spin_unlock_irqrestore(&dev->execute_task_lock, flags); | ||
432 | 428 | ||
433 | atomic_set(&task->task_state_active, 0); | 429 | list_del(&task->t_state_list); |
434 | atomic_dec(&cmd->t_task_cdbs_ex_left); | 430 | atomic_dec(&cmd->t_task_cdbs_ex_left); |
431 | task->t_state_active = false; | ||
432 | } | ||
433 | spin_unlock_irqrestore(&dev->execute_task_lock, flags); | ||
435 | } | 434 | } |
435 | |||
436 | } | 436 | } |
437 | 437 | ||
438 | /* transport_cmd_check_stop(): | 438 | /* transport_cmd_check_stop(): |
@@ -813,7 +813,7 @@ static void __transport_add_task_to_execute_queue( | |||
813 | head_of_queue = transport_add_task_check_sam_attr(task, task_prev, dev); | 813 | head_of_queue = transport_add_task_check_sam_attr(task, task_prev, dev); |
814 | atomic_inc(&dev->execute_tasks); | 814 | atomic_inc(&dev->execute_tasks); |
815 | 815 | ||
816 | if (atomic_read(&task->task_state_active)) | 816 | if (task->t_state_active) |
817 | return; | 817 | return; |
818 | /* | 818 | /* |
819 | * Determine if this task needs to go to HEAD_OF_QUEUE for the | 819 | * Determine if this task needs to go to HEAD_OF_QUEUE for the |
@@ -827,7 +827,7 @@ static void __transport_add_task_to_execute_queue( | |||
827 | else | 827 | else |
828 | list_add_tail(&task->t_state_list, &dev->state_task_list); | 828 | list_add_tail(&task->t_state_list, &dev->state_task_list); |
829 | 829 | ||
830 | atomic_set(&task->task_state_active, 1); | 830 | task->t_state_active = true; |
831 | 831 | ||
832 | pr_debug("Added ITT: 0x%08x task[%p] to dev: %p\n", | 832 | pr_debug("Added ITT: 0x%08x task[%p] to dev: %p\n", |
833 | task->task_se_cmd->se_tfo->get_task_tag(task->task_se_cmd), | 833 | task->task_se_cmd->se_tfo->get_task_tag(task->task_se_cmd), |
@@ -842,17 +842,16 @@ static void transport_add_tasks_to_state_queue(struct se_cmd *cmd) | |||
842 | 842 | ||
843 | spin_lock_irqsave(&cmd->t_state_lock, flags); | 843 | spin_lock_irqsave(&cmd->t_state_lock, flags); |
844 | list_for_each_entry(task, &cmd->t_task_list, t_list) { | 844 | list_for_each_entry(task, &cmd->t_task_list, t_list) { |
845 | if (atomic_read(&task->task_state_active)) | ||
846 | continue; | ||
847 | |||
848 | spin_lock(&dev->execute_task_lock); | 845 | spin_lock(&dev->execute_task_lock); |
849 | list_add_tail(&task->t_state_list, &dev->state_task_list); | 846 | if (!task->t_state_active) { |
850 | atomic_set(&task->task_state_active, 1); | 847 | list_add_tail(&task->t_state_list, |
851 | 848 | &dev->state_task_list); | |
852 | pr_debug("Added ITT: 0x%08x task[%p] to dev: %p\n", | 849 | task->t_state_active = true; |
853 | task->task_se_cmd->se_tfo->get_task_tag( | 850 | |
854 | task->task_se_cmd), task, dev); | 851 | pr_debug("Added ITT: 0x%08x task[%p] to dev: %p\n", |
855 | 852 | task->task_se_cmd->se_tfo->get_task_tag( | |
853 | task->task_se_cmd), task, dev); | ||
854 | } | ||
856 | spin_unlock(&dev->execute_task_lock); | 855 | spin_unlock(&dev->execute_task_lock); |
857 | } | 856 | } |
858 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | 857 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); |
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index e2473e6770b3..311f5fc607e6 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h | |||
@@ -491,10 +491,10 @@ struct se_task { | |||
491 | u16 task_flags; | 491 | u16 task_flags; |
492 | u8 task_scsi_status; | 492 | u8 task_scsi_status; |
493 | enum dma_data_direction task_data_direction; | 493 | enum dma_data_direction task_data_direction; |
494 | atomic_t task_state_active; | ||
495 | struct list_head t_list; | 494 | struct list_head t_list; |
496 | struct list_head t_execute_list; | 495 | struct list_head t_execute_list; |
497 | struct list_head t_state_list; | 496 | struct list_head t_state_list; |
497 | bool t_state_active; | ||
498 | struct completion task_stop_comp; | 498 | struct completion task_stop_comp; |
499 | } ____cacheline_aligned; | 499 | } ____cacheline_aligned; |
500 | 500 | ||