diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2007-12-13 13:43:40 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-01-11 19:28:50 -0500 |
commit | 4545a88fc1ae2c0cd1da6e35f3adcbc56ff27b07 (patch) | |
tree | c5c01dcb6c1a82b314b6cba8f04802e9638a5b9b /drivers/scsi/iscsi_tcp.c | |
parent | 66bbe0ce11c7ebe20cd1d4b5d271b2e124e223c5 (diff) |
[SCSI] iscsi_tcp: hold lock during data rsp processing
iscsi_data_rsp needs to hold the sesison lock when it calls
iscsi_update_cmdsn.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/iscsi_tcp.c')
-rw-r--r-- | drivers/scsi/iscsi_tcp.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 84c4a5026bcb..edebdf27af9b 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c | |||
@@ -641,13 +641,11 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) | |||
641 | } | 641 | } |
642 | 642 | ||
643 | /* fill-in new R2T associated with the task */ | 643 | /* fill-in new R2T associated with the task */ |
644 | spin_lock(&session->lock); | ||
645 | iscsi_update_cmdsn(session, (struct iscsi_nopin*)rhdr); | 644 | iscsi_update_cmdsn(session, (struct iscsi_nopin*)rhdr); |
646 | 645 | ||
647 | if (!ctask->sc || session->state != ISCSI_STATE_LOGGED_IN) { | 646 | if (!ctask->sc || session->state != ISCSI_STATE_LOGGED_IN) { |
648 | printk(KERN_INFO "iscsi_tcp: dropping R2T itt %d in " | 647 | printk(KERN_INFO "iscsi_tcp: dropping R2T itt %d in " |
649 | "recovery...\n", ctask->itt); | 648 | "recovery...\n", ctask->itt); |
650 | spin_unlock(&session->lock); | ||
651 | return 0; | 649 | return 0; |
652 | } | 650 | } |
653 | 651 | ||
@@ -660,7 +658,6 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) | |||
660 | printk(KERN_ERR "iscsi_tcp: invalid R2T with zero data len\n"); | 658 | printk(KERN_ERR "iscsi_tcp: invalid R2T with zero data len\n"); |
661 | __kfifo_put(tcp_ctask->r2tpool.queue, (void*)&r2t, | 659 | __kfifo_put(tcp_ctask->r2tpool.queue, (void*)&r2t, |
662 | sizeof(void*)); | 660 | sizeof(void*)); |
663 | spin_unlock(&session->lock); | ||
664 | return ISCSI_ERR_DATALEN; | 661 | return ISCSI_ERR_DATALEN; |
665 | } | 662 | } |
666 | 663 | ||
@@ -676,7 +673,6 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) | |||
676 | r2t->data_offset, scsi_bufflen(ctask->sc)); | 673 | r2t->data_offset, scsi_bufflen(ctask->sc)); |
677 | __kfifo_put(tcp_ctask->r2tpool.queue, (void*)&r2t, | 674 | __kfifo_put(tcp_ctask->r2tpool.queue, (void*)&r2t, |
678 | sizeof(void*)); | 675 | sizeof(void*)); |
679 | spin_unlock(&session->lock); | ||
680 | return ISCSI_ERR_DATALEN; | 676 | return ISCSI_ERR_DATALEN; |
681 | } | 677 | } |
682 | 678 | ||
@@ -690,8 +686,6 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) | |||
690 | conn->r2t_pdus_cnt++; | 686 | conn->r2t_pdus_cnt++; |
691 | 687 | ||
692 | iscsi_requeue_ctask(ctask); | 688 | iscsi_requeue_ctask(ctask); |
693 | spin_unlock(&session->lock); | ||
694 | |||
695 | return 0; | 689 | return 0; |
696 | } | 690 | } |
697 | 691 | ||
@@ -764,7 +758,9 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr) | |||
764 | switch(opcode) { | 758 | switch(opcode) { |
765 | case ISCSI_OP_SCSI_DATA_IN: | 759 | case ISCSI_OP_SCSI_DATA_IN: |
766 | ctask = session->cmds[itt]; | 760 | ctask = session->cmds[itt]; |
761 | spin_lock(&conn->session->lock); | ||
767 | rc = iscsi_data_rsp(conn, ctask); | 762 | rc = iscsi_data_rsp(conn, ctask); |
763 | spin_unlock(&conn->session->lock); | ||
768 | if (rc) | 764 | if (rc) |
769 | return rc; | 765 | return rc; |
770 | if (tcp_conn->in.datalen) { | 766 | if (tcp_conn->in.datalen) { |
@@ -806,9 +802,11 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr) | |||
806 | ctask = session->cmds[itt]; | 802 | ctask = session->cmds[itt]; |
807 | if (ahslen) | 803 | if (ahslen) |
808 | rc = ISCSI_ERR_AHSLEN; | 804 | rc = ISCSI_ERR_AHSLEN; |
809 | else if (ctask->sc->sc_data_direction == DMA_TO_DEVICE) | 805 | else if (ctask->sc->sc_data_direction == DMA_TO_DEVICE) { |
806 | spin_lock(&session->lock); | ||
810 | rc = iscsi_r2t_rsp(conn, ctask); | 807 | rc = iscsi_r2t_rsp(conn, ctask); |
811 | else | 808 | spin_unlock(&session->lock); |
809 | } else | ||
812 | rc = ISCSI_ERR_PROTO; | 810 | rc = ISCSI_ERR_PROTO; |
813 | break; | 811 | break; |
814 | case ISCSI_OP_LOGIN_RSP: | 812 | case ISCSI_OP_LOGIN_RSP: |