diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2014-02-03 15:53:51 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-03-24 00:38:21 -0400 |
commit | af737f6739b80e4a9fc471fa0595740caf720714 (patch) | |
tree | e316bea7cb8d1a1a7ccf9804342d082b761df4c8 | |
parent | 22fc72288f35219585f11fd40e663c0d3a30a28a (diff) |
iscsi/iser-target: Use list_del_init for ->i_conn_node
commit 5159d763f60af693a3fcec45dce2021f66e528a4 upstream.
There are a handful of uses of list_empty() for cmd->i_conn_node
within iser-target code that expect to return false once a cmd
has been removed from the per connect list.
This patch changes all uses of list_del -> list_del_init in order
to ensure that list_empty() returns false as expected.
Acked-by: Sagi Grimberg <sagig@mellanox.com>
Cc: Or Gerlitz <ogerlitz@mellanox.com>
Cc: <stable@vger.kernel.org> #3.10+
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/infiniband/ulp/isert/ib_isert.c | 6 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target.c | 4 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_erl2.c | 16 |
3 files changed, 13 insertions, 13 deletions
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index 6fc283a041d6..45ac70bfd7e3 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c | |||
@@ -1213,7 +1213,7 @@ isert_put_cmd(struct isert_cmd *isert_cmd) | |||
1213 | case ISCSI_OP_SCSI_CMD: | 1213 | case ISCSI_OP_SCSI_CMD: |
1214 | spin_lock_bh(&conn->cmd_lock); | 1214 | spin_lock_bh(&conn->cmd_lock); |
1215 | if (!list_empty(&cmd->i_conn_node)) | 1215 | if (!list_empty(&cmd->i_conn_node)) |
1216 | list_del(&cmd->i_conn_node); | 1216 | list_del_init(&cmd->i_conn_node); |
1217 | spin_unlock_bh(&conn->cmd_lock); | 1217 | spin_unlock_bh(&conn->cmd_lock); |
1218 | 1218 | ||
1219 | if (cmd->data_direction == DMA_TO_DEVICE) | 1219 | if (cmd->data_direction == DMA_TO_DEVICE) |
@@ -1225,7 +1225,7 @@ isert_put_cmd(struct isert_cmd *isert_cmd) | |||
1225 | case ISCSI_OP_SCSI_TMFUNC: | 1225 | case ISCSI_OP_SCSI_TMFUNC: |
1226 | spin_lock_bh(&conn->cmd_lock); | 1226 | spin_lock_bh(&conn->cmd_lock); |
1227 | if (!list_empty(&cmd->i_conn_node)) | 1227 | if (!list_empty(&cmd->i_conn_node)) |
1228 | list_del(&cmd->i_conn_node); | 1228 | list_del_init(&cmd->i_conn_node); |
1229 | spin_unlock_bh(&conn->cmd_lock); | 1229 | spin_unlock_bh(&conn->cmd_lock); |
1230 | 1230 | ||
1231 | transport_generic_free_cmd(&cmd->se_cmd, 0); | 1231 | transport_generic_free_cmd(&cmd->se_cmd, 0); |
@@ -1234,7 +1234,7 @@ isert_put_cmd(struct isert_cmd *isert_cmd) | |||
1234 | case ISCSI_OP_NOOP_OUT: | 1234 | case ISCSI_OP_NOOP_OUT: |
1235 | spin_lock_bh(&conn->cmd_lock); | 1235 | spin_lock_bh(&conn->cmd_lock); |
1236 | if (!list_empty(&cmd->i_conn_node)) | 1236 | if (!list_empty(&cmd->i_conn_node)) |
1237 | list_del(&cmd->i_conn_node); | 1237 | list_del_init(&cmd->i_conn_node); |
1238 | spin_unlock_bh(&conn->cmd_lock); | 1238 | spin_unlock_bh(&conn->cmd_lock); |
1239 | 1239 | ||
1240 | /* | 1240 | /* |
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 5b07fd156bd7..59a5319ee50c 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
@@ -3653,7 +3653,7 @@ iscsit_immediate_queue(struct iscsi_conn *conn, struct iscsi_cmd *cmd, int state | |||
3653 | break; | 3653 | break; |
3654 | case ISTATE_REMOVE: | 3654 | case ISTATE_REMOVE: |
3655 | spin_lock_bh(&conn->cmd_lock); | 3655 | spin_lock_bh(&conn->cmd_lock); |
3656 | list_del(&cmd->i_conn_node); | 3656 | list_del_init(&cmd->i_conn_node); |
3657 | spin_unlock_bh(&conn->cmd_lock); | 3657 | spin_unlock_bh(&conn->cmd_lock); |
3658 | 3658 | ||
3659 | iscsit_free_cmd(cmd, false); | 3659 | iscsit_free_cmd(cmd, false); |
@@ -4099,7 +4099,7 @@ static void iscsit_release_commands_from_conn(struct iscsi_conn *conn) | |||
4099 | spin_lock_bh(&conn->cmd_lock); | 4099 | spin_lock_bh(&conn->cmd_lock); |
4100 | list_for_each_entry_safe(cmd, cmd_tmp, &conn->conn_cmd_list, i_conn_node) { | 4100 | list_for_each_entry_safe(cmd, cmd_tmp, &conn->conn_cmd_list, i_conn_node) { |
4101 | 4101 | ||
4102 | list_del(&cmd->i_conn_node); | 4102 | list_del_init(&cmd->i_conn_node); |
4103 | spin_unlock_bh(&conn->cmd_lock); | 4103 | spin_unlock_bh(&conn->cmd_lock); |
4104 | 4104 | ||
4105 | iscsit_increment_maxcmdsn(cmd, sess); | 4105 | iscsit_increment_maxcmdsn(cmd, sess); |
diff --git a/drivers/target/iscsi/iscsi_target_erl2.c b/drivers/target/iscsi/iscsi_target_erl2.c index 45a5afd5ea13..0d2d013076c4 100644 --- a/drivers/target/iscsi/iscsi_target_erl2.c +++ b/drivers/target/iscsi/iscsi_target_erl2.c | |||
@@ -140,7 +140,7 @@ void iscsit_free_connection_recovery_entires(struct iscsi_session *sess) | |||
140 | list_for_each_entry_safe(cmd, cmd_tmp, | 140 | list_for_each_entry_safe(cmd, cmd_tmp, |
141 | &cr->conn_recovery_cmd_list, i_conn_node) { | 141 | &cr->conn_recovery_cmd_list, i_conn_node) { |
142 | 142 | ||
143 | list_del(&cmd->i_conn_node); | 143 | list_del_init(&cmd->i_conn_node); |
144 | cmd->conn = NULL; | 144 | cmd->conn = NULL; |
145 | spin_unlock(&cr->conn_recovery_cmd_lock); | 145 | spin_unlock(&cr->conn_recovery_cmd_lock); |
146 | iscsit_free_cmd(cmd, true); | 146 | iscsit_free_cmd(cmd, true); |
@@ -162,7 +162,7 @@ void iscsit_free_connection_recovery_entires(struct iscsi_session *sess) | |||
162 | list_for_each_entry_safe(cmd, cmd_tmp, | 162 | list_for_each_entry_safe(cmd, cmd_tmp, |
163 | &cr->conn_recovery_cmd_list, i_conn_node) { | 163 | &cr->conn_recovery_cmd_list, i_conn_node) { |
164 | 164 | ||
165 | list_del(&cmd->i_conn_node); | 165 | list_del_init(&cmd->i_conn_node); |
166 | cmd->conn = NULL; | 166 | cmd->conn = NULL; |
167 | spin_unlock(&cr->conn_recovery_cmd_lock); | 167 | spin_unlock(&cr->conn_recovery_cmd_lock); |
168 | iscsit_free_cmd(cmd, true); | 168 | iscsit_free_cmd(cmd, true); |
@@ -218,7 +218,7 @@ int iscsit_remove_cmd_from_connection_recovery( | |||
218 | } | 218 | } |
219 | cr = cmd->cr; | 219 | cr = cmd->cr; |
220 | 220 | ||
221 | list_del(&cmd->i_conn_node); | 221 | list_del_init(&cmd->i_conn_node); |
222 | return --cr->cmd_count; | 222 | return --cr->cmd_count; |
223 | } | 223 | } |
224 | 224 | ||
@@ -299,7 +299,7 @@ int iscsit_discard_unacknowledged_ooo_cmdsns_for_conn(struct iscsi_conn *conn) | |||
299 | if (!(cmd->cmd_flags & ICF_OOO_CMDSN)) | 299 | if (!(cmd->cmd_flags & ICF_OOO_CMDSN)) |
300 | continue; | 300 | continue; |
301 | 301 | ||
302 | list_del(&cmd->i_conn_node); | 302 | list_del_init(&cmd->i_conn_node); |
303 | 303 | ||
304 | spin_unlock_bh(&conn->cmd_lock); | 304 | spin_unlock_bh(&conn->cmd_lock); |
305 | iscsit_free_cmd(cmd, true); | 305 | iscsit_free_cmd(cmd, true); |
@@ -337,7 +337,7 @@ int iscsit_prepare_cmds_for_realligance(struct iscsi_conn *conn) | |||
337 | /* | 337 | /* |
338 | * Only perform connection recovery on ISCSI_OP_SCSI_CMD or | 338 | * Only perform connection recovery on ISCSI_OP_SCSI_CMD or |
339 | * ISCSI_OP_NOOP_OUT opcodes. For all other opcodes call | 339 | * ISCSI_OP_NOOP_OUT opcodes. For all other opcodes call |
340 | * list_del(&cmd->i_conn_node); to release the command to the | 340 | * list_del_init(&cmd->i_conn_node); to release the command to the |
341 | * session pool and remove it from the connection's list. | 341 | * session pool and remove it from the connection's list. |
342 | * | 342 | * |
343 | * Also stop the DataOUT timer, which will be restarted after | 343 | * Also stop the DataOUT timer, which will be restarted after |
@@ -353,7 +353,7 @@ int iscsit_prepare_cmds_for_realligance(struct iscsi_conn *conn) | |||
353 | " CID: %hu\n", cmd->iscsi_opcode, | 353 | " CID: %hu\n", cmd->iscsi_opcode, |
354 | cmd->init_task_tag, cmd->cmd_sn, conn->cid); | 354 | cmd->init_task_tag, cmd->cmd_sn, conn->cid); |
355 | 355 | ||
356 | list_del(&cmd->i_conn_node); | 356 | list_del_init(&cmd->i_conn_node); |
357 | spin_unlock_bh(&conn->cmd_lock); | 357 | spin_unlock_bh(&conn->cmd_lock); |
358 | iscsit_free_cmd(cmd, true); | 358 | iscsit_free_cmd(cmd, true); |
359 | spin_lock_bh(&conn->cmd_lock); | 359 | spin_lock_bh(&conn->cmd_lock); |
@@ -373,7 +373,7 @@ int iscsit_prepare_cmds_for_realligance(struct iscsi_conn *conn) | |||
373 | */ | 373 | */ |
374 | if (!(cmd->cmd_flags & ICF_OOO_CMDSN) && !cmd->immediate_cmd && | 374 | if (!(cmd->cmd_flags & ICF_OOO_CMDSN) && !cmd->immediate_cmd && |
375 | iscsi_sna_gte(cmd->cmd_sn, conn->sess->exp_cmd_sn)) { | 375 | iscsi_sna_gte(cmd->cmd_sn, conn->sess->exp_cmd_sn)) { |
376 | list_del(&cmd->i_conn_node); | 376 | list_del_init(&cmd->i_conn_node); |
377 | spin_unlock_bh(&conn->cmd_lock); | 377 | spin_unlock_bh(&conn->cmd_lock); |
378 | iscsit_free_cmd(cmd, true); | 378 | iscsit_free_cmd(cmd, true); |
379 | spin_lock_bh(&conn->cmd_lock); | 379 | spin_lock_bh(&conn->cmd_lock); |
@@ -395,7 +395,7 @@ int iscsit_prepare_cmds_for_realligance(struct iscsi_conn *conn) | |||
395 | 395 | ||
396 | cmd->sess = conn->sess; | 396 | cmd->sess = conn->sess; |
397 | 397 | ||
398 | list_del(&cmd->i_conn_node); | 398 | list_del_init(&cmd->i_conn_node); |
399 | spin_unlock_bh(&conn->cmd_lock); | 399 | spin_unlock_bh(&conn->cmd_lock); |
400 | 400 | ||
401 | iscsit_free_all_datain_reqs(cmd); | 401 | iscsit_free_all_datain_reqs(cmd); |