diff options
-rw-r--r-- | drivers/target/iscsi/iscsi_target.c | 1 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_configfs.c | 3 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_core.h | 1 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_util.c | 25 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_util.h | 1 |
5 files changed, 26 insertions, 5 deletions
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 8203bf3de848..b01a10eae365 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
@@ -489,6 +489,7 @@ static struct iscsit_transport iscsi_target_transport = { | |||
489 | .iscsit_setup_np = iscsit_setup_np, | 489 | .iscsit_setup_np = iscsit_setup_np, |
490 | .iscsit_accept_np = iscsit_accept_np, | 490 | .iscsit_accept_np = iscsit_accept_np, |
491 | .iscsit_free_np = iscsit_free_np, | 491 | .iscsit_free_np = iscsit_free_np, |
492 | .iscsit_alloc_cmd = iscsit_alloc_cmd, | ||
492 | .iscsit_get_login_rx = iscsit_get_login_rx, | 493 | .iscsit_get_login_rx = iscsit_get_login_rx, |
493 | .iscsit_put_login_tx = iscsit_put_login_tx, | 494 | .iscsit_put_login_tx = iscsit_put_login_tx, |
494 | }; | 495 | }; |
diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c index 78d75c8567d0..c78b824194e6 100644 --- a/drivers/target/iscsi/iscsi_target_configfs.c +++ b/drivers/target/iscsi/iscsi_target_configfs.c | |||
@@ -1700,7 +1700,8 @@ static void lio_release_cmd(struct se_cmd *se_cmd) | |||
1700 | { | 1700 | { |
1701 | struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd); | 1701 | struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd); |
1702 | 1702 | ||
1703 | iscsit_release_cmd(cmd); | 1703 | pr_debug("Entering lio_release_cmd for se_cmd: %p\n", se_cmd); |
1704 | cmd->release_cmd(cmd); | ||
1704 | } | 1705 | } |
1705 | 1706 | ||
1706 | /* End functions for target_core_fabric_ops */ | 1707 | /* End functions for target_core_fabric_ops */ |
diff --git a/drivers/target/iscsi/iscsi_target_core.h b/drivers/target/iscsi/iscsi_target_core.h index 53400b0bf711..60ec4b92be03 100644 --- a/drivers/target/iscsi/iscsi_target_core.h +++ b/drivers/target/iscsi/iscsi_target_core.h | |||
@@ -485,6 +485,7 @@ struct iscsi_cmd { | |||
485 | u32 first_data_sg_off; | 485 | u32 first_data_sg_off; |
486 | u32 kmapped_nents; | 486 | u32 kmapped_nents; |
487 | sense_reason_t sense_reason; | 487 | sense_reason_t sense_reason; |
488 | void (*release_cmd)(struct iscsi_cmd *); | ||
488 | } ____cacheline_aligned; | 489 | } ____cacheline_aligned; |
489 | 490 | ||
490 | struct iscsi_tmr_req { | 491 | struct iscsi_tmr_req { |
diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c index 4cf1e7f94ac3..0b73f90c9c54 100644 --- a/drivers/target/iscsi/iscsi_target_util.c +++ b/drivers/target/iscsi/iscsi_target_util.c | |||
@@ -149,6 +149,18 @@ void iscsit_free_r2ts_from_list(struct iscsi_cmd *cmd) | |||
149 | spin_unlock_bh(&cmd->r2t_lock); | 149 | spin_unlock_bh(&cmd->r2t_lock); |
150 | } | 150 | } |
151 | 151 | ||
152 | struct iscsi_cmd *iscsit_alloc_cmd(struct iscsi_conn *conn, gfp_t gfp_mask) | ||
153 | { | ||
154 | struct iscsi_cmd *cmd; | ||
155 | |||
156 | cmd = kmem_cache_zalloc(lio_cmd_cache, gfp_mask); | ||
157 | if (!cmd) | ||
158 | return NULL; | ||
159 | |||
160 | cmd->release_cmd = &iscsit_release_cmd; | ||
161 | return cmd; | ||
162 | } | ||
163 | |||
152 | /* | 164 | /* |
153 | * May be called from software interrupt (timer) context for allocating | 165 | * May be called from software interrupt (timer) context for allocating |
154 | * iSCSI NopINs. | 166 | * iSCSI NopINs. |
@@ -157,13 +169,12 @@ struct iscsi_cmd *iscsit_allocate_cmd(struct iscsi_conn *conn, gfp_t gfp_mask) | |||
157 | { | 169 | { |
158 | struct iscsi_cmd *cmd; | 170 | struct iscsi_cmd *cmd; |
159 | 171 | ||
160 | cmd = kmem_cache_zalloc(lio_cmd_cache, gfp_mask); | 172 | cmd = conn->conn_transport->iscsit_alloc_cmd(conn, gfp_mask); |
161 | if (!cmd) { | 173 | if (!cmd) { |
162 | pr_err("Unable to allocate memory for struct iscsi_cmd.\n"); | 174 | pr_err("Unable to allocate memory for struct iscsi_cmd.\n"); |
163 | return NULL; | 175 | return NULL; |
164 | } | 176 | } |
165 | 177 | cmd->conn = conn; | |
166 | cmd->conn = conn; | ||
167 | INIT_LIST_HEAD(&cmd->i_conn_node); | 178 | INIT_LIST_HEAD(&cmd->i_conn_node); |
168 | INIT_LIST_HEAD(&cmd->datain_list); | 179 | INIT_LIST_HEAD(&cmd->datain_list); |
169 | INIT_LIST_HEAD(&cmd->cmd_r2t_list); | 180 | INIT_LIST_HEAD(&cmd->cmd_r2t_list); |
@@ -176,6 +187,7 @@ struct iscsi_cmd *iscsit_allocate_cmd(struct iscsi_conn *conn, gfp_t gfp_mask) | |||
176 | 187 | ||
177 | return cmd; | 188 | return cmd; |
178 | } | 189 | } |
190 | EXPORT_SYMBOL(iscsit_allocate_cmd); | ||
179 | 191 | ||
180 | struct iscsi_seq *iscsit_get_seq_holder_for_datain( | 192 | struct iscsi_seq *iscsit_get_seq_holder_for_datain( |
181 | struct iscsi_cmd *cmd, | 193 | struct iscsi_cmd *cmd, |
@@ -690,6 +702,11 @@ void iscsit_free_cmd(struct iscsi_cmd *cmd) | |||
690 | */ | 702 | */ |
691 | switch (cmd->iscsi_opcode) { | 703 | switch (cmd->iscsi_opcode) { |
692 | case ISCSI_OP_SCSI_CMD: | 704 | case ISCSI_OP_SCSI_CMD: |
705 | if (cmd->data_direction == DMA_TO_DEVICE) | ||
706 | iscsit_stop_dataout_timer(cmd); | ||
707 | /* | ||
708 | * Fallthrough | ||
709 | */ | ||
693 | case ISCSI_OP_SCSI_TMFUNC: | 710 | case ISCSI_OP_SCSI_TMFUNC: |
694 | transport_generic_free_cmd(&cmd->se_cmd, 1); | 711 | transport_generic_free_cmd(&cmd->se_cmd, 1); |
695 | break; | 712 | break; |
@@ -705,7 +722,7 @@ void iscsit_free_cmd(struct iscsi_cmd *cmd) | |||
705 | } | 722 | } |
706 | /* Fall-through */ | 723 | /* Fall-through */ |
707 | default: | 724 | default: |
708 | iscsit_release_cmd(cmd); | 725 | cmd->release_cmd(cmd); |
709 | break; | 726 | break; |
710 | } | 727 | } |
711 | } | 728 | } |
diff --git a/drivers/target/iscsi/iscsi_target_util.h b/drivers/target/iscsi/iscsi_target_util.h index 894d0f837924..4f8e01a47081 100644 --- a/drivers/target/iscsi/iscsi_target_util.h +++ b/drivers/target/iscsi/iscsi_target_util.h | |||
@@ -8,6 +8,7 @@ extern struct iscsi_r2t *iscsit_get_r2t_for_eos(struct iscsi_cmd *, u32, u32); | |||
8 | extern struct iscsi_r2t *iscsit_get_r2t_from_list(struct iscsi_cmd *); | 8 | extern struct iscsi_r2t *iscsit_get_r2t_from_list(struct iscsi_cmd *); |
9 | extern void iscsit_free_r2t(struct iscsi_r2t *, struct iscsi_cmd *); | 9 | extern void iscsit_free_r2t(struct iscsi_r2t *, struct iscsi_cmd *); |
10 | extern void iscsit_free_r2ts_from_list(struct iscsi_cmd *); | 10 | extern void iscsit_free_r2ts_from_list(struct iscsi_cmd *); |
11 | extern struct iscsi_cmd *iscsit_alloc_cmd(struct iscsi_conn *, gfp_t); | ||
11 | extern struct iscsi_cmd *iscsit_allocate_cmd(struct iscsi_conn *, gfp_t); | 12 | extern struct iscsi_cmd *iscsit_allocate_cmd(struct iscsi_conn *, gfp_t); |
12 | extern struct iscsi_seq *iscsit_get_seq_holder_for_datain(struct iscsi_cmd *, u32); | 13 | extern struct iscsi_seq *iscsit_get_seq_holder_for_datain(struct iscsi_cmd *, u32); |
13 | extern struct iscsi_seq *iscsit_get_seq_holder_for_r2t(struct iscsi_cmd *); | 14 | extern struct iscsi_seq *iscsit_get_seq_holder_for_r2t(struct iscsi_cmd *); |