diff options
author | Roland Dreier <roland@purestorage.com> | 2011-07-20 05:28:56 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2011-07-22 05:37:45 -0400 |
commit | 5e1be919820175a2becc3c72051050aaa3fae954 (patch) | |
tree | 50b987bb753e481fd0d921e5723deacd17f5a97f /drivers/target/target_core_tmr.c | |
parent | 56e34ee2adb59a35bfa5714bdf4dcb3f4d14a41d (diff) |
target: Make se_tmr_lock IRQ-safe
transport_lookup_tmr_lun() can be called from interrupt context and
therefore needs to use IRQ-safe spinlock functions. Fix this up, and
to make the locking work, convert the other uses of se_tmr_lock to be
IRQ-disabling.
Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_tmr.c')
-rw-r--r-- | drivers/target/target_core_tmr.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index 5c20de3f1d1c..f1feea3b2319 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c | |||
@@ -80,9 +80,9 @@ void core_tmr_release_req( | |||
80 | return; | 80 | return; |
81 | } | 81 | } |
82 | 82 | ||
83 | spin_lock(&dev->se_tmr_lock); | 83 | spin_lock_irq(&dev->se_tmr_lock); |
84 | list_del(&tmr->tmr_list); | 84 | list_del(&tmr->tmr_list); |
85 | spin_unlock(&dev->se_tmr_lock); | 85 | spin_unlock_irq(&dev->se_tmr_lock); |
86 | 86 | ||
87 | kmem_cache_free(se_tmr_req_cache, tmr); | 87 | kmem_cache_free(se_tmr_req_cache, tmr); |
88 | } | 88 | } |
@@ -154,7 +154,7 @@ int core_tmr_lun_reset( | |||
154 | * Release all pending and outgoing TMRs aside from the received | 154 | * Release all pending and outgoing TMRs aside from the received |
155 | * LUN_RESET tmr.. | 155 | * LUN_RESET tmr.. |
156 | */ | 156 | */ |
157 | spin_lock(&dev->se_tmr_lock); | 157 | spin_lock_irq(&dev->se_tmr_lock); |
158 | list_for_each_entry_safe(tmr_p, tmr_pp, &dev->dev_tmr_list, tmr_list) { | 158 | list_for_each_entry_safe(tmr_p, tmr_pp, &dev->dev_tmr_list, tmr_list) { |
159 | /* | 159 | /* |
160 | * Allow the received TMR to return with FUNCTION_COMPLETE. | 160 | * Allow the received TMR to return with FUNCTION_COMPLETE. |
@@ -176,17 +176,17 @@ int core_tmr_lun_reset( | |||
176 | (core_scsi3_check_cdb_abort_and_preempt( | 176 | (core_scsi3_check_cdb_abort_and_preempt( |
177 | preempt_and_abort_list, cmd) != 0)) | 177 | preempt_and_abort_list, cmd) != 0)) |
178 | continue; | 178 | continue; |
179 | spin_unlock(&dev->se_tmr_lock); | 179 | spin_unlock_irq(&dev->se_tmr_lock); |
180 | 180 | ||
181 | spin_lock_irqsave(&cmd->t_state_lock, flags); | 181 | spin_lock_irqsave(&cmd->t_state_lock, flags); |
182 | if (!(atomic_read(&cmd->t_transport_active))) { | 182 | if (!(atomic_read(&cmd->t_transport_active))) { |
183 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | 183 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); |
184 | spin_lock(&dev->se_tmr_lock); | 184 | spin_lock_irq(&dev->se_tmr_lock); |
185 | continue; | 185 | continue; |
186 | } | 186 | } |
187 | if (cmd->t_state == TRANSPORT_ISTATE_PROCESSING) { | 187 | if (cmd->t_state == TRANSPORT_ISTATE_PROCESSING) { |
188 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | 188 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); |
189 | spin_lock(&dev->se_tmr_lock); | 189 | spin_lock_irq(&dev->se_tmr_lock); |
190 | continue; | 190 | continue; |
191 | } | 191 | } |
192 | DEBUG_LR("LUN_RESET: %s releasing TMR %p Function: 0x%02x," | 192 | DEBUG_LR("LUN_RESET: %s releasing TMR %p Function: 0x%02x," |
@@ -196,9 +196,9 @@ int core_tmr_lun_reset( | |||
196 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | 196 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); |
197 | 197 | ||
198 | transport_cmd_finish_abort_tmr(cmd); | 198 | transport_cmd_finish_abort_tmr(cmd); |
199 | spin_lock(&dev->se_tmr_lock); | 199 | spin_lock_irq(&dev->se_tmr_lock); |
200 | } | 200 | } |
201 | spin_unlock(&dev->se_tmr_lock); | 201 | spin_unlock_irq(&dev->se_tmr_lock); |
202 | /* | 202 | /* |
203 | * Complete outstanding struct se_task CDBs with TASK_ABORTED SAM status. | 203 | * Complete outstanding struct se_task CDBs with TASK_ABORTED SAM status. |
204 | * This is following sam4r17, section 5.6 Aborting commands, Table 38 | 204 | * This is following sam4r17, section 5.6 Aborting commands, Table 38 |