diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2006-11-08 16:58:33 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.(none)> | 2006-11-09 19:41:48 -0500 |
commit | db37c505e5dfc1a26d6c82f1ce0c3ae06641c3e0 (patch) | |
tree | f2c74d03a43cc6b5c5949ecd838502ab9c770048 /drivers/scsi/iscsi_tcp.c | |
parent | d6e24d1c8a197cc9c2a1568224474f4b7af50803 (diff) |
[SCSI] iscsi_tcp: fix xmittask oops
XMSTATE_SOL_HDR could be set when the xmit thread tests it, but there may
not be anything on the r2tqueue yet. Move the XMSTATE_SOL_HDR set
before the addition to the queue to make sure that when we pull something
off it it is valid. This does not add locks around the xmstate test or make
that a atmoic_t because this is a fast path and if it is set when we test it
we can handle it there without the overhead. Later on we check the xmitqueue
for all requests with the session lock so we will not miss it.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/iscsi_tcp.c')
-rw-r--r-- | drivers/scsi/iscsi_tcp.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index c0b8b33e935c..d0b139cccbbc 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c | |||
@@ -415,8 +415,8 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) | |||
415 | iscsi_solicit_data_init(conn, ctask, r2t); | 415 | iscsi_solicit_data_init(conn, ctask, r2t); |
416 | 416 | ||
417 | tcp_ctask->exp_r2tsn = r2tsn + 1; | 417 | tcp_ctask->exp_r2tsn = r2tsn + 1; |
418 | tcp_ctask->xmstate |= XMSTATE_SOL_HDR; | ||
419 | __kfifo_put(tcp_ctask->r2tqueue, (void*)&r2t, sizeof(void*)); | 418 | __kfifo_put(tcp_ctask->r2tqueue, (void*)&r2t, sizeof(void*)); |
419 | tcp_ctask->xmstate |= XMSTATE_SOL_HDR; | ||
420 | list_move_tail(&ctask->running, &conn->xmitqueue); | 420 | list_move_tail(&ctask->running, &conn->xmitqueue); |
421 | 421 | ||
422 | scsi_queue_work(session->host, &conn->xmitwork); | 422 | scsi_queue_work(session->host, &conn->xmitwork); |
@@ -1627,9 +1627,12 @@ static int iscsi_send_sol_pdu(struct iscsi_conn *conn, | |||
1627 | if (tcp_ctask->xmstate & XMSTATE_SOL_HDR) { | 1627 | if (tcp_ctask->xmstate & XMSTATE_SOL_HDR) { |
1628 | tcp_ctask->xmstate &= ~XMSTATE_SOL_HDR; | 1628 | tcp_ctask->xmstate &= ~XMSTATE_SOL_HDR; |
1629 | tcp_ctask->xmstate |= XMSTATE_SOL_DATA; | 1629 | tcp_ctask->xmstate |= XMSTATE_SOL_DATA; |
1630 | if (!tcp_ctask->r2t) | 1630 | if (!tcp_ctask->r2t) { |
1631 | spin_lock_bh(&session->lock); | ||
1631 | __kfifo_get(tcp_ctask->r2tqueue, (void*)&tcp_ctask->r2t, | 1632 | __kfifo_get(tcp_ctask->r2tqueue, (void*)&tcp_ctask->r2t, |
1632 | sizeof(void*)); | 1633 | sizeof(void*)); |
1634 | spin_unlock_bh(&session->lock); | ||
1635 | } | ||
1633 | send_hdr: | 1636 | send_hdr: |
1634 | r2t = tcp_ctask->r2t; | 1637 | r2t = tcp_ctask->r2t; |
1635 | dtask = &r2t->dtask; | 1638 | dtask = &r2t->dtask; |