aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorAndy Grover <agrover@redhat.com>2012-04-03 18:51:08 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2012-04-14 20:40:34 -0400
commit4580cf38483790a4304a15328303566a054d4ea5 (patch)
treee0f237256ec32ba4c9e98ecdbd36e4e752a7cbac /drivers/target
parentc6037cc546ca10cbdc5b60f0598b4ddcb181fe5d (diff)
target/iscsi: Remove unneeded locking from iscsi_target_tx_thread
When processing immediate queue, we're switching on a local variable so it's not necessary to lock around it. However, we are modifying cmd->i_state in two spots, so lock around those parts only. Signed-off-by: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/iscsi/iscsi_target.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index e77b045c9b78..8428fa51beed 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -3516,15 +3516,11 @@ restart:
3516 state = qr->state; 3516 state = qr->state;
3517 kmem_cache_free(lio_qr_cache, qr); 3517 kmem_cache_free(lio_qr_cache, qr);
3518 3518
3519 spin_lock_bh(&cmd->istate_lock);
3520 switch (state) { 3519 switch (state) {
3521 case ISTATE_SEND_R2T: 3520 case ISTATE_SEND_R2T:
3522 spin_unlock_bh(&cmd->istate_lock);
3523 ret = iscsit_send_r2t(cmd, conn); 3521 ret = iscsit_send_r2t(cmd, conn);
3524 break; 3522 break;
3525 case ISTATE_REMOVE: 3523 case ISTATE_REMOVE:
3526 spin_unlock_bh(&cmd->istate_lock);
3527
3528 if (cmd->data_direction == DMA_TO_DEVICE) 3524 if (cmd->data_direction == DMA_TO_DEVICE)
3529 iscsit_stop_dataout_timer(cmd); 3525 iscsit_stop_dataout_timer(cmd);
3530 3526
@@ -3535,13 +3531,11 @@ restart:
3535 iscsit_free_cmd(cmd); 3531 iscsit_free_cmd(cmd);
3536 continue; 3532 continue;
3537 case ISTATE_SEND_NOPIN_WANT_RESPONSE: 3533 case ISTATE_SEND_NOPIN_WANT_RESPONSE:
3538 spin_unlock_bh(&cmd->istate_lock);
3539 iscsit_mod_nopin_response_timer(conn); 3534 iscsit_mod_nopin_response_timer(conn);
3540 ret = iscsit_send_unsolicited_nopin(cmd, 3535 ret = iscsit_send_unsolicited_nopin(cmd,
3541 conn, 1); 3536 conn, 1);
3542 break; 3537 break;
3543 case ISTATE_SEND_NOPIN_NO_RESPONSE: 3538 case ISTATE_SEND_NOPIN_NO_RESPONSE:
3544 spin_unlock_bh(&cmd->istate_lock);
3545 ret = iscsit_send_unsolicited_nopin(cmd, 3539 ret = iscsit_send_unsolicited_nopin(cmd,
3546 conn, 0); 3540 conn, 0);
3547 break; 3541 break;
@@ -3550,7 +3544,6 @@ restart:
3550 " 0x%08x, i_state: %d on CID: %hu\n", 3544 " 0x%08x, i_state: %d on CID: %hu\n",
3551 cmd->iscsi_opcode, cmd->init_task_tag, state, 3545 cmd->iscsi_opcode, cmd->init_task_tag, state,
3552 conn->cid); 3546 conn->cid);
3553 spin_unlock_bh(&cmd->istate_lock);
3554 goto transport_err; 3547 goto transport_err;
3555 } 3548 }
3556 if (ret < 0) 3549 if (ret < 0)
@@ -3561,19 +3554,19 @@ restart:
3561 goto transport_err; 3554 goto transport_err;
3562 } 3555 }
3563 3556
3564 spin_lock_bh(&cmd->istate_lock);
3565 switch (state) { 3557 switch (state) {
3566 case ISTATE_SEND_R2T: 3558 case ISTATE_SEND_R2T:
3567 spin_unlock_bh(&cmd->istate_lock);
3568 spin_lock_bh(&cmd->dataout_timeout_lock); 3559 spin_lock_bh(&cmd->dataout_timeout_lock);
3569 iscsit_start_dataout_timer(cmd, conn); 3560 iscsit_start_dataout_timer(cmd, conn);
3570 spin_unlock_bh(&cmd->dataout_timeout_lock); 3561 spin_unlock_bh(&cmd->dataout_timeout_lock);
3571 break; 3562 break;
3572 case ISTATE_SEND_NOPIN_WANT_RESPONSE: 3563 case ISTATE_SEND_NOPIN_WANT_RESPONSE:
3564 spin_lock_bh(&cmd->istate_lock);
3573 cmd->i_state = ISTATE_SENT_NOPIN_WANT_RESPONSE; 3565 cmd->i_state = ISTATE_SENT_NOPIN_WANT_RESPONSE;
3574 spin_unlock_bh(&cmd->istate_lock); 3566 spin_unlock_bh(&cmd->istate_lock);
3575 break; 3567 break;
3576 case ISTATE_SEND_NOPIN_NO_RESPONSE: 3568 case ISTATE_SEND_NOPIN_NO_RESPONSE:
3569 spin_lock_bh(&cmd->istate_lock);
3577 cmd->i_state = ISTATE_SENT_STATUS; 3570 cmd->i_state = ISTATE_SENT_STATUS;
3578 spin_unlock_bh(&cmd->istate_lock); 3571 spin_unlock_bh(&cmd->istate_lock);
3579 break; 3572 break;
@@ -3582,7 +3575,6 @@ restart:
3582 " 0x%08x, i_state: %d on CID: %hu\n", 3575 " 0x%08x, i_state: %d on CID: %hu\n",
3583 cmd->iscsi_opcode, cmd->init_task_tag, 3576 cmd->iscsi_opcode, cmd->init_task_tag,
3584 state, conn->cid); 3577 state, conn->cid);
3585 spin_unlock_bh(&cmd->istate_lock);
3586 goto transport_err; 3578 goto transport_err;
3587 } 3579 }
3588 } 3580 }