diff options
Diffstat (limited to 'drivers/target/target_core_tmr.c')
-rw-r--r-- | drivers/target/target_core_tmr.c | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index 179063d81cdd..2f73749b8151 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c | |||
@@ -117,7 +117,7 @@ int core_tmr_lun_reset( | |||
117 | struct se_queue_req *qr, *qr_tmp; | 117 | struct se_queue_req *qr, *qr_tmp; |
118 | struct se_node_acl *tmr_nacl = NULL; | 118 | struct se_node_acl *tmr_nacl = NULL; |
119 | struct se_portal_group *tmr_tpg = NULL; | 119 | struct se_portal_group *tmr_tpg = NULL; |
120 | struct se_queue_obj *qobj = dev->dev_queue_obj; | 120 | struct se_queue_obj *qobj = &dev->dev_queue_obj; |
121 | struct se_tmr_req *tmr_p, *tmr_pp; | 121 | struct se_tmr_req *tmr_p, *tmr_pp; |
122 | struct se_task *task, *task_tmp; | 122 | struct se_task *task, *task_tmp; |
123 | unsigned long flags; | 123 | unsigned long flags; |
@@ -133,7 +133,7 @@ int core_tmr_lun_reset( | |||
133 | * which the command was received shall be completed with TASK ABORTED | 133 | * which the command was received shall be completed with TASK ABORTED |
134 | * status (see SAM-4). | 134 | * status (see SAM-4). |
135 | */ | 135 | */ |
136 | tas = DEV_ATTRIB(dev)->emulate_tas; | 136 | tas = dev->se_sub_dev->se_dev_attrib.emulate_tas; |
137 | /* | 137 | /* |
138 | * Determine if this se_tmr is coming from a $FABRIC_MOD | 138 | * Determine if this se_tmr is coming from a $FABRIC_MOD |
139 | * or struct se_device passthrough.. | 139 | * or struct se_device passthrough.. |
@@ -144,13 +144,13 @@ int core_tmr_lun_reset( | |||
144 | if (tmr_nacl && tmr_tpg) { | 144 | if (tmr_nacl && tmr_tpg) { |
145 | DEBUG_LR("LUN_RESET: TMR caller fabric: %s" | 145 | DEBUG_LR("LUN_RESET: TMR caller fabric: %s" |
146 | " initiator port %s\n", | 146 | " initiator port %s\n", |
147 | TPG_TFO(tmr_tpg)->get_fabric_name(), | 147 | tmr_tpg->se_tpg_tfo->get_fabric_name(), |
148 | tmr_nacl->initiatorname); | 148 | tmr_nacl->initiatorname); |
149 | } | 149 | } |
150 | } | 150 | } |
151 | DEBUG_LR("LUN_RESET: %s starting for [%s], tas: %d\n", | 151 | DEBUG_LR("LUN_RESET: %s starting for [%s], tas: %d\n", |
152 | (preempt_and_abort_list) ? "Preempt" : "TMR", | 152 | (preempt_and_abort_list) ? "Preempt" : "TMR", |
153 | TRANSPORT(dev)->name, tas); | 153 | dev->transport->name, tas); |
154 | /* | 154 | /* |
155 | * Release all pending and outgoing TMRs aside from the received | 155 | * Release all pending and outgoing TMRs aside from the received |
156 | * LUN_RESET tmr.. | 156 | * LUN_RESET tmr.. |
@@ -179,14 +179,14 @@ int core_tmr_lun_reset( | |||
179 | continue; | 179 | continue; |
180 | spin_unlock(&dev->se_tmr_lock); | 180 | spin_unlock(&dev->se_tmr_lock); |
181 | 181 | ||
182 | spin_lock_irqsave(&T_TASK(cmd)->t_state_lock, flags); | 182 | spin_lock_irqsave(&cmd->t_task->t_state_lock, flags); |
183 | if (!(atomic_read(&T_TASK(cmd)->t_transport_active))) { | 183 | if (!(atomic_read(&cmd->t_task->t_transport_active))) { |
184 | spin_unlock_irqrestore(&T_TASK(cmd)->t_state_lock, flags); | 184 | spin_unlock_irqrestore(&cmd->t_task->t_state_lock, flags); |
185 | spin_lock(&dev->se_tmr_lock); | 185 | spin_lock(&dev->se_tmr_lock); |
186 | continue; | 186 | continue; |
187 | } | 187 | } |
188 | if (cmd->t_state == TRANSPORT_ISTATE_PROCESSING) { | 188 | if (cmd->t_state == TRANSPORT_ISTATE_PROCESSING) { |
189 | spin_unlock_irqrestore(&T_TASK(cmd)->t_state_lock, flags); | 189 | spin_unlock_irqrestore(&cmd->t_task->t_state_lock, flags); |
190 | spin_lock(&dev->se_tmr_lock); | 190 | spin_lock(&dev->se_tmr_lock); |
191 | continue; | 191 | continue; |
192 | } | 192 | } |
@@ -194,7 +194,7 @@ int core_tmr_lun_reset( | |||
194 | " Response: 0x%02x, t_state: %d\n", | 194 | " Response: 0x%02x, t_state: %d\n", |
195 | (preempt_and_abort_list) ? "Preempt" : "", tmr_p, | 195 | (preempt_and_abort_list) ? "Preempt" : "", tmr_p, |
196 | tmr_p->function, tmr_p->response, cmd->t_state); | 196 | tmr_p->function, tmr_p->response, cmd->t_state); |
197 | spin_unlock_irqrestore(&T_TASK(cmd)->t_state_lock, flags); | 197 | spin_unlock_irqrestore(&cmd->t_task->t_state_lock, flags); |
198 | 198 | ||
199 | transport_cmd_finish_abort_tmr(cmd); | 199 | transport_cmd_finish_abort_tmr(cmd); |
200 | spin_lock(&dev->se_tmr_lock); | 200 | spin_lock(&dev->se_tmr_lock); |
@@ -224,16 +224,16 @@ int core_tmr_lun_reset( | |||
224 | spin_lock_irqsave(&dev->execute_task_lock, flags); | 224 | spin_lock_irqsave(&dev->execute_task_lock, flags); |
225 | list_for_each_entry_safe(task, task_tmp, &dev->state_task_list, | 225 | list_for_each_entry_safe(task, task_tmp, &dev->state_task_list, |
226 | t_state_list) { | 226 | t_state_list) { |
227 | if (!(TASK_CMD(task))) { | 227 | if (!task->task_se_cmd) { |
228 | printk(KERN_ERR "TASK_CMD(task) is NULL!\n"); | 228 | printk(KERN_ERR "task->task_se_cmd is NULL!\n"); |
229 | continue; | 229 | continue; |
230 | } | 230 | } |
231 | cmd = TASK_CMD(task); | 231 | cmd = task->task_se_cmd; |
232 | 232 | ||
233 | if (!T_TASK(cmd)) { | 233 | if (!cmd->t_task) { |
234 | printk(KERN_ERR "T_TASK(cmd) is NULL for task: %p cmd:" | 234 | printk(KERN_ERR "cmd->t_task is NULL for task: %p cmd:" |
235 | " %p ITT: 0x%08x\n", task, cmd, | 235 | " %p ITT: 0x%08x\n", task, cmd, |
236 | CMD_TFO(cmd)->get_task_tag(cmd)); | 236 | cmd->se_tfo->get_task_tag(cmd)); |
237 | continue; | 237 | continue; |
238 | } | 238 | } |
239 | /* | 239 | /* |
@@ -254,38 +254,38 @@ int core_tmr_lun_reset( | |||
254 | atomic_set(&task->task_state_active, 0); | 254 | atomic_set(&task->task_state_active, 0); |
255 | spin_unlock_irqrestore(&dev->execute_task_lock, flags); | 255 | spin_unlock_irqrestore(&dev->execute_task_lock, flags); |
256 | 256 | ||
257 | spin_lock_irqsave(&T_TASK(cmd)->t_state_lock, flags); | 257 | spin_lock_irqsave(&cmd->t_task->t_state_lock, flags); |
258 | DEBUG_LR("LUN_RESET: %s cmd: %p task: %p" | 258 | DEBUG_LR("LUN_RESET: %s cmd: %p task: %p" |
259 | " ITT/CmdSN: 0x%08x/0x%08x, i_state: %d, t_state/" | 259 | " ITT/CmdSN: 0x%08x/0x%08x, i_state: %d, t_state/" |
260 | "def_t_state: %d/%d cdb: 0x%02x\n", | 260 | "def_t_state: %d/%d cdb: 0x%02x\n", |
261 | (preempt_and_abort_list) ? "Preempt" : "", cmd, task, | 261 | (preempt_and_abort_list) ? "Preempt" : "", cmd, task, |
262 | CMD_TFO(cmd)->get_task_tag(cmd), 0, | 262 | cmd->se_tfo->get_task_tag(cmd), 0, |
263 | CMD_TFO(cmd)->get_cmd_state(cmd), cmd->t_state, | 263 | cmd->se_tfo->get_cmd_state(cmd), cmd->t_state, |
264 | cmd->deferred_t_state, T_TASK(cmd)->t_task_cdb[0]); | 264 | cmd->deferred_t_state, cmd->t_task->t_task_cdb[0]); |
265 | DEBUG_LR("LUN_RESET: ITT[0x%08x] - pr_res_key: 0x%016Lx" | 265 | DEBUG_LR("LUN_RESET: ITT[0x%08x] - pr_res_key: 0x%016Lx" |
266 | " t_task_cdbs: %d t_task_cdbs_left: %d" | 266 | " t_task_cdbs: %d t_task_cdbs_left: %d" |
267 | " t_task_cdbs_sent: %d -- t_transport_active: %d" | 267 | " t_task_cdbs_sent: %d -- t_transport_active: %d" |
268 | " t_transport_stop: %d t_transport_sent: %d\n", | 268 | " t_transport_stop: %d t_transport_sent: %d\n", |
269 | CMD_TFO(cmd)->get_task_tag(cmd), cmd->pr_res_key, | 269 | cmd->se_tfo->get_task_tag(cmd), cmd->pr_res_key, |
270 | T_TASK(cmd)->t_task_cdbs, | 270 | cmd->t_task->t_task_cdbs, |
271 | atomic_read(&T_TASK(cmd)->t_task_cdbs_left), | 271 | atomic_read(&cmd->t_task->t_task_cdbs_left), |
272 | atomic_read(&T_TASK(cmd)->t_task_cdbs_sent), | 272 | atomic_read(&cmd->t_task->t_task_cdbs_sent), |
273 | atomic_read(&T_TASK(cmd)->t_transport_active), | 273 | atomic_read(&cmd->t_task->t_transport_active), |
274 | atomic_read(&T_TASK(cmd)->t_transport_stop), | 274 | atomic_read(&cmd->t_task->t_transport_stop), |
275 | atomic_read(&T_TASK(cmd)->t_transport_sent)); | 275 | atomic_read(&cmd->t_task->t_transport_sent)); |
276 | 276 | ||
277 | if (atomic_read(&task->task_active)) { | 277 | if (atomic_read(&task->task_active)) { |
278 | atomic_set(&task->task_stop, 1); | 278 | atomic_set(&task->task_stop, 1); |
279 | spin_unlock_irqrestore( | 279 | spin_unlock_irqrestore( |
280 | &T_TASK(cmd)->t_state_lock, flags); | 280 | &cmd->t_task->t_state_lock, flags); |
281 | 281 | ||
282 | DEBUG_LR("LUN_RESET: Waiting for task: %p to shutdown" | 282 | DEBUG_LR("LUN_RESET: Waiting for task: %p to shutdown" |
283 | " for dev: %p\n", task, dev); | 283 | " for dev: %p\n", task, dev); |
284 | wait_for_completion(&task->task_stop_comp); | 284 | wait_for_completion(&task->task_stop_comp); |
285 | DEBUG_LR("LUN_RESET Completed task: %p shutdown for" | 285 | DEBUG_LR("LUN_RESET Completed task: %p shutdown for" |
286 | " dev: %p\n", task, dev); | 286 | " dev: %p\n", task, dev); |
287 | spin_lock_irqsave(&T_TASK(cmd)->t_state_lock, flags); | 287 | spin_lock_irqsave(&cmd->t_task->t_state_lock, flags); |
288 | atomic_dec(&T_TASK(cmd)->t_task_cdbs_left); | 288 | atomic_dec(&cmd->t_task->t_task_cdbs_left); |
289 | 289 | ||
290 | atomic_set(&task->task_active, 0); | 290 | atomic_set(&task->task_active, 0); |
291 | atomic_set(&task->task_stop, 0); | 291 | atomic_set(&task->task_stop, 0); |
@@ -295,24 +295,24 @@ int core_tmr_lun_reset( | |||
295 | } | 295 | } |
296 | __transport_stop_task_timer(task, &flags); | 296 | __transport_stop_task_timer(task, &flags); |
297 | 297 | ||
298 | if (!(atomic_dec_and_test(&T_TASK(cmd)->t_task_cdbs_ex_left))) { | 298 | if (!(atomic_dec_and_test(&cmd->t_task->t_task_cdbs_ex_left))) { |
299 | spin_unlock_irqrestore( | 299 | spin_unlock_irqrestore( |
300 | &T_TASK(cmd)->t_state_lock, flags); | 300 | &cmd->t_task->t_state_lock, flags); |
301 | DEBUG_LR("LUN_RESET: Skipping task: %p, dev: %p for" | 301 | DEBUG_LR("LUN_RESET: Skipping task: %p, dev: %p for" |
302 | " t_task_cdbs_ex_left: %d\n", task, dev, | 302 | " t_task_cdbs_ex_left: %d\n", task, dev, |
303 | atomic_read(&T_TASK(cmd)->t_task_cdbs_ex_left)); | 303 | atomic_read(&cmd->t_task->t_task_cdbs_ex_left)); |
304 | 304 | ||
305 | spin_lock_irqsave(&dev->execute_task_lock, flags); | 305 | spin_lock_irqsave(&dev->execute_task_lock, flags); |
306 | continue; | 306 | continue; |
307 | } | 307 | } |
308 | fe_count = atomic_read(&T_TASK(cmd)->t_fe_count); | 308 | fe_count = atomic_read(&cmd->t_task->t_fe_count); |
309 | 309 | ||
310 | if (atomic_read(&T_TASK(cmd)->t_transport_active)) { | 310 | if (atomic_read(&cmd->t_task->t_transport_active)) { |
311 | DEBUG_LR("LUN_RESET: got t_transport_active = 1 for" | 311 | DEBUG_LR("LUN_RESET: got t_transport_active = 1 for" |
312 | " task: %p, t_fe_count: %d dev: %p\n", task, | 312 | " task: %p, t_fe_count: %d dev: %p\n", task, |
313 | fe_count, dev); | 313 | fe_count, dev); |
314 | atomic_set(&T_TASK(cmd)->t_transport_aborted, 1); | 314 | atomic_set(&cmd->t_task->t_transport_aborted, 1); |
315 | spin_unlock_irqrestore(&T_TASK(cmd)->t_state_lock, | 315 | spin_unlock_irqrestore(&cmd->t_task->t_state_lock, |
316 | flags); | 316 | flags); |
317 | core_tmr_handle_tas_abort(tmr_nacl, cmd, tas, fe_count); | 317 | core_tmr_handle_tas_abort(tmr_nacl, cmd, tas, fe_count); |
318 | 318 | ||
@@ -321,8 +321,8 @@ int core_tmr_lun_reset( | |||
321 | } | 321 | } |
322 | DEBUG_LR("LUN_RESET: Got t_transport_active = 0 for task: %p," | 322 | DEBUG_LR("LUN_RESET: Got t_transport_active = 0 for task: %p," |
323 | " t_fe_count: %d dev: %p\n", task, fe_count, dev); | 323 | " t_fe_count: %d dev: %p\n", task, fe_count, dev); |
324 | atomic_set(&T_TASK(cmd)->t_transport_aborted, 1); | 324 | atomic_set(&cmd->t_task->t_transport_aborted, 1); |
325 | spin_unlock_irqrestore(&T_TASK(cmd)->t_state_lock, flags); | 325 | spin_unlock_irqrestore(&cmd->t_task->t_state_lock, flags); |
326 | core_tmr_handle_tas_abort(tmr_nacl, cmd, tas, fe_count); | 326 | core_tmr_handle_tas_abort(tmr_nacl, cmd, tas, fe_count); |
327 | 327 | ||
328 | spin_lock_irqsave(&dev->execute_task_lock, flags); | 328 | spin_lock_irqsave(&dev->execute_task_lock, flags); |
@@ -365,7 +365,7 @@ int core_tmr_lun_reset( | |||
365 | if (prout_cmd == cmd) | 365 | if (prout_cmd == cmd) |
366 | continue; | 366 | continue; |
367 | 367 | ||
368 | atomic_dec(&T_TASK(cmd)->t_transport_queue_active); | 368 | atomic_dec(&cmd->t_task->t_transport_queue_active); |
369 | atomic_dec(&qobj->queue_cnt); | 369 | atomic_dec(&qobj->queue_cnt); |
370 | list_del(&qr->qr_list); | 370 | list_del(&qr->qr_list); |
371 | spin_unlock_irqrestore(&qobj->cmd_queue_lock, flags); | 371 | spin_unlock_irqrestore(&qobj->cmd_queue_lock, flags); |
@@ -376,7 +376,7 @@ int core_tmr_lun_reset( | |||
376 | DEBUG_LR("LUN_RESET: %s from Device Queue: cmd: %p t_state:" | 376 | DEBUG_LR("LUN_RESET: %s from Device Queue: cmd: %p t_state:" |
377 | " %d t_fe_count: %d\n", (preempt_and_abort_list) ? | 377 | " %d t_fe_count: %d\n", (preempt_and_abort_list) ? |
378 | "Preempt" : "", cmd, state, | 378 | "Preempt" : "", cmd, state, |
379 | atomic_read(&T_TASK(cmd)->t_fe_count)); | 379 | atomic_read(&cmd->t_task->t_fe_count)); |
380 | /* | 380 | /* |
381 | * Signal that the command has failed via cmd->se_cmd_flags, | 381 | * Signal that the command has failed via cmd->se_cmd_flags, |
382 | * and call TFO->new_cmd_failure() to wakeup any fabric | 382 | * and call TFO->new_cmd_failure() to wakeup any fabric |
@@ -388,7 +388,7 @@ int core_tmr_lun_reset( | |||
388 | transport_new_cmd_failure(cmd); | 388 | transport_new_cmd_failure(cmd); |
389 | 389 | ||
390 | core_tmr_handle_tas_abort(tmr_nacl, cmd, tas, | 390 | core_tmr_handle_tas_abort(tmr_nacl, cmd, tas, |
391 | atomic_read(&T_TASK(cmd)->t_fe_count)); | 391 | atomic_read(&cmd->t_task->t_fe_count)); |
392 | spin_lock_irqsave(&qobj->cmd_queue_lock, flags); | 392 | spin_lock_irqsave(&qobj->cmd_queue_lock, flags); |
393 | } | 393 | } |
394 | spin_unlock_irqrestore(&qobj->cmd_queue_lock, flags); | 394 | spin_unlock_irqrestore(&qobj->cmd_queue_lock, flags); |
@@ -411,6 +411,6 @@ int core_tmr_lun_reset( | |||
411 | 411 | ||
412 | DEBUG_LR("LUN_RESET: %s for [%s] Complete\n", | 412 | DEBUG_LR("LUN_RESET: %s for [%s] Complete\n", |
413 | (preempt_and_abort_list) ? "Preempt" : "TMR", | 413 | (preempt_and_abort_list) ? "Preempt" : "TMR", |
414 | TRANSPORT(dev)->name); | 414 | dev->transport->name); |
415 | return 0; | 415 | return 0; |
416 | } | 416 | } |