diff options
-rw-r--r-- | drivers/scsi/qla2xxx/tcm_qla2xxx.c | 2 | ||||
-rw-r--r-- | drivers/target/target_core_transport.c | 22 | ||||
-rw-r--r-- | include/target/target_core_base.h | 1 | ||||
-rw-r--r-- | include/target/target_core_fabric.h | 2 |
4 files changed, 12 insertions, 15 deletions
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index e131d689e573..65a7ed9ac81d 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c | |||
@@ -464,7 +464,7 @@ static int tcm_qla2xxx_shutdown_session(struct se_session *se_sess) | |||
464 | vha = sess->vha; | 464 | vha = sess->vha; |
465 | 465 | ||
466 | spin_lock_irqsave(&vha->hw->hardware_lock, flags); | 466 | spin_lock_irqsave(&vha->hw->hardware_lock, flags); |
467 | target_splice_sess_cmd_list(se_sess); | 467 | target_sess_cmd_list_set_waiting(se_sess); |
468 | spin_unlock_irqrestore(&vha->hw->hardware_lock, flags); | 468 | spin_unlock_irqrestore(&vha->hw->hardware_lock, flags); |
469 | 469 | ||
470 | return 1; | 470 | return 1; |
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index a979514061e7..357bb24afba2 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -232,7 +232,6 @@ struct se_session *transport_init_session(void) | |||
232 | INIT_LIST_HEAD(&se_sess->sess_list); | 232 | INIT_LIST_HEAD(&se_sess->sess_list); |
233 | INIT_LIST_HEAD(&se_sess->sess_acl_list); | 233 | INIT_LIST_HEAD(&se_sess->sess_acl_list); |
234 | INIT_LIST_HEAD(&se_sess->sess_cmd_list); | 234 | INIT_LIST_HEAD(&se_sess->sess_cmd_list); |
235 | INIT_LIST_HEAD(&se_sess->sess_wait_list); | ||
236 | spin_lock_init(&se_sess->sess_cmd_lock); | 235 | spin_lock_init(&se_sess->sess_cmd_lock); |
237 | kref_init(&se_sess->sess_kref); | 236 | kref_init(&se_sess->sess_kref); |
238 | 237 | ||
@@ -2478,28 +2477,27 @@ int target_put_sess_cmd(struct se_session *se_sess, struct se_cmd *se_cmd) | |||
2478 | } | 2477 | } |
2479 | EXPORT_SYMBOL(target_put_sess_cmd); | 2478 | EXPORT_SYMBOL(target_put_sess_cmd); |
2480 | 2479 | ||
2481 | /* target_splice_sess_cmd_list - Split active cmds into sess_wait_list | 2480 | /* target_sess_cmd_list_set_waiting - Flag all commands in |
2482 | * @se_sess: session to split | 2481 | * sess_cmd_list to complete cmd_wait_comp. Set |
2482 | * sess_tearing_down so no more commands are queued. | ||
2483 | * @se_sess: session to flag | ||
2483 | */ | 2484 | */ |
2484 | void target_splice_sess_cmd_list(struct se_session *se_sess) | 2485 | void target_sess_cmd_list_set_waiting(struct se_session *se_sess) |
2485 | { | 2486 | { |
2486 | struct se_cmd *se_cmd; | 2487 | struct se_cmd *se_cmd; |
2487 | unsigned long flags; | 2488 | unsigned long flags; |
2488 | 2489 | ||
2489 | WARN_ON(!list_empty(&se_sess->sess_wait_list)); | ||
2490 | INIT_LIST_HEAD(&se_sess->sess_wait_list); | ||
2491 | |||
2492 | spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); | 2490 | spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); |
2493 | se_sess->sess_tearing_down = 1; | ||
2494 | 2491 | ||
2495 | list_splice_init(&se_sess->sess_cmd_list, &se_sess->sess_wait_list); | 2492 | WARN_ON(se_sess->sess_tearing_down); |
2493 | se_sess->sess_tearing_down = 1; | ||
2496 | 2494 | ||
2497 | list_for_each_entry(se_cmd, &se_sess->sess_wait_list, se_cmd_list) | 2495 | list_for_each_entry(se_cmd, &se_sess->sess_cmd_list, se_cmd_list) |
2498 | se_cmd->cmd_wait_set = 1; | 2496 | se_cmd->cmd_wait_set = 1; |
2499 | 2497 | ||
2500 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); | 2498 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); |
2501 | } | 2499 | } |
2502 | EXPORT_SYMBOL(target_splice_sess_cmd_list); | 2500 | EXPORT_SYMBOL(target_sess_cmd_list_set_waiting); |
2503 | 2501 | ||
2504 | /* target_wait_for_sess_cmds - Wait for outstanding descriptors | 2502 | /* target_wait_for_sess_cmds - Wait for outstanding descriptors |
2505 | * @se_sess: session to wait for active I/O | 2503 | * @se_sess: session to wait for active I/O |
@@ -2513,7 +2511,7 @@ void target_wait_for_sess_cmds( | |||
2513 | bool rc = false; | 2511 | bool rc = false; |
2514 | 2512 | ||
2515 | list_for_each_entry_safe(se_cmd, tmp_cmd, | 2513 | list_for_each_entry_safe(se_cmd, tmp_cmd, |
2516 | &se_sess->sess_wait_list, se_cmd_list) { | 2514 | &se_sess->sess_cmd_list, se_cmd_list) { |
2517 | list_del(&se_cmd->se_cmd_list); | 2515 | list_del(&se_cmd->se_cmd_list); |
2518 | 2516 | ||
2519 | pr_debug("Waiting for se_cmd: %p t_state: %d, fabric state:" | 2517 | pr_debug("Waiting for se_cmd: %p t_state: %d, fabric state:" |
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 4f4f04219b11..fa83ea13b1be 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h | |||
@@ -613,7 +613,6 @@ struct se_session { | |||
613 | struct list_head sess_list; | 613 | struct list_head sess_list; |
614 | struct list_head sess_acl_list; | 614 | struct list_head sess_acl_list; |
615 | struct list_head sess_cmd_list; | 615 | struct list_head sess_cmd_list; |
616 | struct list_head sess_wait_list; | ||
617 | spinlock_t sess_cmd_lock; | 616 | spinlock_t sess_cmd_lock; |
618 | struct kref sess_kref; | 617 | struct kref sess_kref; |
619 | }; | 618 | }; |
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index 2eba240f64aa..815e064028c9 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h | |||
@@ -122,7 +122,7 @@ int transport_check_aborted_status(struct se_cmd *, int); | |||
122 | int transport_send_check_condition_and_sense(struct se_cmd *, u8, int); | 122 | int transport_send_check_condition_and_sense(struct se_cmd *, u8, int); |
123 | 123 | ||
124 | int target_put_sess_cmd(struct se_session *, struct se_cmd *); | 124 | int target_put_sess_cmd(struct se_session *, struct se_cmd *); |
125 | void target_splice_sess_cmd_list(struct se_session *); | 125 | void target_sess_cmd_list_set_waiting(struct se_session *); |
126 | void target_wait_for_sess_cmds(struct se_session *, int); | 126 | void target_wait_for_sess_cmds(struct se_session *, int); |
127 | 127 | ||
128 | int core_alua_check_nonop_delay(struct se_cmd *); | 128 | int core_alua_check_nonop_delay(struct se_cmd *); |