diff options
-rw-r--r-- | drivers/target/iscsi/iscsi_target.c | 4 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_erl2.c | 15 | ||||
-rw-r--r-- | drivers/target/target_core_transport.c | 33 | ||||
-rw-r--r-- | include/target/target_core_base.h | 2 | ||||
-rw-r--r-- | include/target/target_core_transport.h | 2 |
5 files changed, 22 insertions, 34 deletions
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 7dc2cfe9431c..354a8339a3f9 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
@@ -3960,7 +3960,7 @@ static void iscsit_release_commands_from_conn(struct iscsi_conn *conn) | |||
3960 | * iscsit_get_lun_for_cmd() in iscsit_handle_scsi_cmd(). | 3960 | * iscsit_get_lun_for_cmd() in iscsit_handle_scsi_cmd(). |
3961 | */ | 3961 | */ |
3962 | if (cmd->tmr_req && se_cmd->transport_wait_for_tasks) | 3962 | if (cmd->tmr_req && se_cmd->transport_wait_for_tasks) |
3963 | se_cmd->transport_wait_for_tasks(se_cmd, 1, 1); | 3963 | se_cmd->transport_wait_for_tasks(se_cmd, 1); |
3964 | else if (cmd->se_cmd.se_cmd_flags & SCF_SE_LUN_CMD) | 3964 | else if (cmd->se_cmd.se_cmd_flags & SCF_SE_LUN_CMD) |
3965 | transport_release_cmd(se_cmd); | 3965 | transport_release_cmd(se_cmd); |
3966 | else | 3966 | else |
@@ -3976,7 +3976,7 @@ static void iscsit_release_commands_from_conn(struct iscsi_conn *conn) | |||
3976 | se_cmd = &cmd->se_cmd; | 3976 | se_cmd = &cmd->se_cmd; |
3977 | 3977 | ||
3978 | if (se_cmd->transport_wait_for_tasks) | 3978 | if (se_cmd->transport_wait_for_tasks) |
3979 | se_cmd->transport_wait_for_tasks(se_cmd, 1, 1); | 3979 | se_cmd->transport_wait_for_tasks(se_cmd, 1); |
3980 | 3980 | ||
3981 | spin_lock_bh(&conn->cmd_lock); | 3981 | spin_lock_bh(&conn->cmd_lock); |
3982 | } | 3982 | } |
diff --git a/drivers/target/iscsi/iscsi_target_erl2.c b/drivers/target/iscsi/iscsi_target_erl2.c index 91a4d170bda4..000356baf0b5 100644 --- a/drivers/target/iscsi/iscsi_target_erl2.c +++ b/drivers/target/iscsi/iscsi_target_erl2.c | |||
@@ -148,7 +148,7 @@ void iscsit_free_connection_recovery_entires(struct iscsi_session *sess) | |||
148 | iscsit_release_cmd(cmd); | 148 | iscsit_release_cmd(cmd); |
149 | else | 149 | else |
150 | cmd->se_cmd.transport_wait_for_tasks( | 150 | cmd->se_cmd.transport_wait_for_tasks( |
151 | &cmd->se_cmd, 1, 1); | 151 | &cmd->se_cmd, 1); |
152 | spin_lock(&cr->conn_recovery_cmd_lock); | 152 | spin_lock(&cr->conn_recovery_cmd_lock); |
153 | } | 153 | } |
154 | spin_unlock(&cr->conn_recovery_cmd_lock); | 154 | spin_unlock(&cr->conn_recovery_cmd_lock); |
@@ -175,7 +175,7 @@ void iscsit_free_connection_recovery_entires(struct iscsi_session *sess) | |||
175 | iscsit_release_cmd(cmd); | 175 | iscsit_release_cmd(cmd); |
176 | else | 176 | else |
177 | cmd->se_cmd.transport_wait_for_tasks( | 177 | cmd->se_cmd.transport_wait_for_tasks( |
178 | &cmd->se_cmd, 1, 1); | 178 | &cmd->se_cmd, 1); |
179 | spin_lock(&cr->conn_recovery_cmd_lock); | 179 | spin_lock(&cr->conn_recovery_cmd_lock); |
180 | } | 180 | } |
181 | spin_unlock(&cr->conn_recovery_cmd_lock); | 181 | spin_unlock(&cr->conn_recovery_cmd_lock); |
@@ -265,7 +265,7 @@ void iscsit_discard_cr_cmds_by_expstatsn( | |||
265 | iscsit_release_cmd(cmd); | 265 | iscsit_release_cmd(cmd); |
266 | else | 266 | else |
267 | cmd->se_cmd.transport_wait_for_tasks( | 267 | cmd->se_cmd.transport_wait_for_tasks( |
268 | &cmd->se_cmd, 1, 0); | 268 | &cmd->se_cmd, 1); |
269 | spin_lock(&cr->conn_recovery_cmd_lock); | 269 | spin_lock(&cr->conn_recovery_cmd_lock); |
270 | } | 270 | } |
271 | spin_unlock(&cr->conn_recovery_cmd_lock); | 271 | spin_unlock(&cr->conn_recovery_cmd_lock); |
@@ -324,7 +324,7 @@ int iscsit_discard_unacknowledged_ooo_cmdsns_for_conn(struct iscsi_conn *conn) | |||
324 | iscsit_release_cmd(cmd); | 324 | iscsit_release_cmd(cmd); |
325 | else | 325 | else |
326 | cmd->se_cmd.transport_wait_for_tasks( | 326 | cmd->se_cmd.transport_wait_for_tasks( |
327 | &cmd->se_cmd, 1, 1); | 327 | &cmd->se_cmd, 1); |
328 | spin_lock_bh(&conn->cmd_lock); | 328 | spin_lock_bh(&conn->cmd_lock); |
329 | } | 329 | } |
330 | spin_unlock_bh(&conn->cmd_lock); | 330 | spin_unlock_bh(&conn->cmd_lock); |
@@ -383,7 +383,7 @@ int iscsit_prepare_cmds_for_realligance(struct iscsi_conn *conn) | |||
383 | iscsit_release_cmd(cmd); | 383 | iscsit_release_cmd(cmd); |
384 | else | 384 | else |
385 | cmd->se_cmd.transport_wait_for_tasks( | 385 | cmd->se_cmd.transport_wait_for_tasks( |
386 | &cmd->se_cmd, 1, 0); | 386 | &cmd->se_cmd, 1); |
387 | spin_lock_bh(&conn->cmd_lock); | 387 | spin_lock_bh(&conn->cmd_lock); |
388 | continue; | 388 | continue; |
389 | } | 389 | } |
@@ -409,7 +409,7 @@ int iscsit_prepare_cmds_for_realligance(struct iscsi_conn *conn) | |||
409 | iscsit_release_cmd(cmd); | 409 | iscsit_release_cmd(cmd); |
410 | else | 410 | else |
411 | cmd->se_cmd.transport_wait_for_tasks( | 411 | cmd->se_cmd.transport_wait_for_tasks( |
412 | &cmd->se_cmd, 1, 1); | 412 | &cmd->se_cmd, 1); |
413 | spin_lock_bh(&conn->cmd_lock); | 413 | spin_lock_bh(&conn->cmd_lock); |
414 | continue; | 414 | continue; |
415 | } | 415 | } |
@@ -436,8 +436,7 @@ int iscsit_prepare_cmds_for_realligance(struct iscsi_conn *conn) | |||
436 | 436 | ||
437 | if ((cmd->se_cmd.se_cmd_flags & SCF_SE_LUN_CMD) && | 437 | if ((cmd->se_cmd.se_cmd_flags & SCF_SE_LUN_CMD) && |
438 | cmd->se_cmd.transport_wait_for_tasks) | 438 | cmd->se_cmd.transport_wait_for_tasks) |
439 | cmd->se_cmd.transport_wait_for_tasks(&cmd->se_cmd, | 439 | cmd->se_cmd.transport_wait_for_tasks(&cmd->se_cmd, 0); |
440 | 0, 0); | ||
441 | /* | 440 | /* |
442 | * Add the struct iscsi_cmd to the connection recovery cmd list | 441 | * Add the struct iscsi_cmd to the connection recovery cmd list |
443 | */ | 442 | */ |
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index db2f8987a046..e5905269c850 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -86,7 +86,7 @@ static u32 transport_allocate_tasks(struct se_cmd *cmd, | |||
86 | enum dma_data_direction data_direction, | 86 | enum dma_data_direction data_direction, |
87 | struct scatterlist *sgl, unsigned int nents); | 87 | struct scatterlist *sgl, unsigned int nents); |
88 | static int transport_generic_get_mem(struct se_cmd *cmd); | 88 | static int transport_generic_get_mem(struct se_cmd *cmd); |
89 | static bool transport_put_cmd(struct se_cmd *cmd); | 89 | static void transport_put_cmd(struct se_cmd *cmd); |
90 | static void transport_remove_cmd_from_queue(struct se_cmd *cmd, | 90 | static void transport_remove_cmd_from_queue(struct se_cmd *cmd, |
91 | struct se_queue_obj *qobj); | 91 | struct se_queue_obj *qobj); |
92 | static int transport_set_sense_codes(struct se_cmd *cmd, u8 asc, u8 ascq); | 92 | static int transport_set_sense_codes(struct se_cmd *cmd, u8 asc, u8 ascq); |
@@ -1638,7 +1638,7 @@ static int transport_check_alloc_task_attr(struct se_cmd *cmd) | |||
1638 | return 0; | 1638 | return 0; |
1639 | } | 1639 | } |
1640 | 1640 | ||
1641 | static void transport_generic_wait_for_tasks(struct se_cmd *, int, int); | 1641 | static void transport_generic_wait_for_tasks(struct se_cmd *, int); |
1642 | 1642 | ||
1643 | /* transport_generic_allocate_tasks(): | 1643 | /* transport_generic_allocate_tasks(): |
1644 | * | 1644 | * |
@@ -2504,7 +2504,7 @@ void transport_new_cmd_failure(struct se_cmd *se_cmd) | |||
2504 | spin_unlock_irqrestore(&se_cmd->t_state_lock, flags); | 2504 | spin_unlock_irqrestore(&se_cmd->t_state_lock, flags); |
2505 | } | 2505 | } |
2506 | 2506 | ||
2507 | static void transport_nop_wait_for_tasks(struct se_cmd *, int, int); | 2507 | static void transport_nop_wait_for_tasks(struct se_cmd *, int); |
2508 | 2508 | ||
2509 | static inline u32 transport_get_sectors_6( | 2509 | static inline u32 transport_get_sectors_6( |
2510 | unsigned char *cdb, | 2510 | unsigned char *cdb, |
@@ -3736,7 +3736,7 @@ static inline void transport_free_pages(struct se_cmd *cmd) | |||
3736 | * | 3736 | * |
3737 | * This routine releases our reference to the command and frees it if possible. | 3737 | * This routine releases our reference to the command and frees it if possible. |
3738 | */ | 3738 | */ |
3739 | static bool transport_put_cmd(struct se_cmd *cmd) | 3739 | static void transport_put_cmd(struct se_cmd *cmd) |
3740 | { | 3740 | { |
3741 | unsigned long flags; | 3741 | unsigned long flags; |
3742 | int free_tasks = 0; | 3742 | int free_tasks = 0; |
@@ -3764,10 +3764,9 @@ static bool transport_put_cmd(struct se_cmd *cmd) | |||
3764 | 3764 | ||
3765 | transport_free_pages(cmd); | 3765 | transport_free_pages(cmd); |
3766 | transport_release_cmd(cmd); | 3766 | transport_release_cmd(cmd); |
3767 | return true; | 3767 | return; |
3768 | out_busy: | 3768 | out_busy: |
3769 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | 3769 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); |
3770 | return false; | ||
3771 | } | 3770 | } |
3772 | 3771 | ||
3773 | /* | 3772 | /* |
@@ -4331,7 +4330,7 @@ void transport_release_cmd(struct se_cmd *cmd) | |||
4331 | } | 4330 | } |
4332 | EXPORT_SYMBOL(transport_release_cmd); | 4331 | EXPORT_SYMBOL(transport_release_cmd); |
4333 | 4332 | ||
4334 | bool transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks) | 4333 | void transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks) |
4335 | { | 4334 | { |
4336 | if (!(cmd->se_cmd_flags & SCF_SE_LUN_CMD)) | 4335 | if (!(cmd->se_cmd_flags & SCF_SE_LUN_CMD)) |
4337 | transport_release_cmd(cmd); | 4336 | transport_release_cmd(cmd); |
@@ -4342,21 +4341,18 @@ bool transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks) | |||
4342 | transport_lun_remove_cmd(cmd); | 4341 | transport_lun_remove_cmd(cmd); |
4343 | 4342 | ||
4344 | if (wait_for_tasks && cmd->transport_wait_for_tasks) | 4343 | if (wait_for_tasks && cmd->transport_wait_for_tasks) |
4345 | cmd->transport_wait_for_tasks(cmd, 0, 0); | 4344 | cmd->transport_wait_for_tasks(cmd, 0); |
4346 | 4345 | ||
4347 | transport_free_dev_tasks(cmd); | 4346 | transport_free_dev_tasks(cmd); |
4348 | 4347 | ||
4349 | return transport_put_cmd(cmd); | 4348 | transport_put_cmd(cmd); |
4350 | } | 4349 | } |
4351 | |||
4352 | return true; | ||
4353 | } | 4350 | } |
4354 | EXPORT_SYMBOL(transport_generic_free_cmd); | 4351 | EXPORT_SYMBOL(transport_generic_free_cmd); |
4355 | 4352 | ||
4356 | static void transport_nop_wait_for_tasks( | 4353 | static void transport_nop_wait_for_tasks( |
4357 | struct se_cmd *cmd, | 4354 | struct se_cmd *cmd, |
4358 | int remove_cmd, | 4355 | int remove_cmd) |
4359 | int session_reinstatement) | ||
4360 | { | 4356 | { |
4361 | return; | 4357 | return; |
4362 | } | 4358 | } |
@@ -4537,8 +4533,7 @@ int transport_clear_lun_from_sessions(struct se_lun *lun) | |||
4537 | */ | 4533 | */ |
4538 | static void transport_generic_wait_for_tasks( | 4534 | static void transport_generic_wait_for_tasks( |
4539 | struct se_cmd *cmd, | 4535 | struct se_cmd *cmd, |
4540 | int remove_cmd, | 4536 | int remove_cmd) |
4541 | int session_reinstatement) | ||
4542 | { | 4537 | { |
4543 | unsigned long flags; | 4538 | unsigned long flags; |
4544 | 4539 | ||
@@ -4614,13 +4609,7 @@ remove: | |||
4614 | if (!remove_cmd) | 4609 | if (!remove_cmd) |
4615 | return; | 4610 | return; |
4616 | 4611 | ||
4617 | if (!transport_generic_free_cmd(cmd, 0) && session_reinstatement) { | 4612 | transport_generic_free_cmd(cmd, 0); |
4618 | unsigned long flags; | ||
4619 | |||
4620 | spin_lock_irqsave(&cmd->t_state_lock, flags); | ||
4621 | transport_all_task_dev_remove_state(cmd); | ||
4622 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | ||
4623 | } | ||
4624 | } | 4613 | } |
4625 | 4614 | ||
4626 | static int transport_get_sense_codes( | 4615 | static int transport_get_sense_codes( |
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 27040653005e..c10e351bc1f5 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h | |||
@@ -480,7 +480,7 @@ struct se_cmd { | |||
480 | struct target_core_fabric_ops *se_tfo; | 480 | struct target_core_fabric_ops *se_tfo; |
481 | int (*transport_emulate_cdb)(struct se_cmd *); | 481 | int (*transport_emulate_cdb)(struct se_cmd *); |
482 | void (*transport_split_cdb)(unsigned long long, u32, unsigned char *); | 482 | void (*transport_split_cdb)(unsigned long long, u32, unsigned char *); |
483 | void (*transport_wait_for_tasks)(struct se_cmd *, int, int); | 483 | void (*transport_wait_for_tasks)(struct se_cmd *, int); |
484 | void (*transport_complete_callback)(struct se_cmd *); | 484 | void (*transport_complete_callback)(struct se_cmd *); |
485 | int (*transport_qf_callback)(struct se_cmd *); | 485 | int (*transport_qf_callback)(struct se_cmd *); |
486 | 486 | ||
diff --git a/include/target/target_core_transport.h b/include/target/target_core_transport.h index a113129fa22e..e67feeb88b69 100644 --- a/include/target/target_core_transport.h +++ b/include/target/target_core_transport.h | |||
@@ -184,7 +184,7 @@ extern int transport_check_aborted_status(struct se_cmd *, int); | |||
184 | extern int transport_send_check_condition_and_sense(struct se_cmd *, u8, int); | 184 | extern int transport_send_check_condition_and_sense(struct se_cmd *, u8, int); |
185 | extern void transport_send_task_abort(struct se_cmd *); | 185 | extern void transport_send_task_abort(struct se_cmd *); |
186 | extern void transport_release_cmd(struct se_cmd *); | 186 | extern void transport_release_cmd(struct se_cmd *); |
187 | extern bool transport_generic_free_cmd(struct se_cmd *, int); | 187 | extern void transport_generic_free_cmd(struct se_cmd *, int); |
188 | extern void transport_generic_wait_for_cmds(struct se_cmd *, int); | 188 | extern void transport_generic_wait_for_cmds(struct se_cmd *, int); |
189 | extern int transport_init_task_sg(struct se_task *, struct se_mem *, u32); | 189 | extern int transport_init_task_sg(struct se_task *, struct se_mem *, u32); |
190 | extern int transport_map_mem_to_sg(struct se_task *, struct list_head *, | 190 | extern int transport_map_mem_to_sg(struct se_task *, struct list_head *, |