]> err.no Git - linux-2.6/commitdiff
[SCSI] iscsi: fix run list corruption
authorMike Christie <michaelc@cs.wisc.edu>
Tue, 30 May 2006 05:37:22 +0000 (00:37 -0500)
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>
Mon, 5 Jun 2006 23:11:18 +0000 (19:11 -0400)
from davidw@netapp.com:

We must grab the session lock when modifying the running lists.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/scsi/libiscsi.c

index 963002598995718e572ab6ae9ac67f5654277aea..a223413e156415306053bb73d0da010acc6d66d9 100644 (file)
@@ -552,8 +552,10 @@ static int iscsi_data_xmit(struct iscsi_conn *conn)
         if (unlikely(__kfifo_len(conn->immqueue))) {
                while (__kfifo_get(conn->immqueue, (void*)&conn->mtask,
                                   sizeof(void*))) {
+                       spin_lock_bh(&conn->session->lock);
                        list_add_tail(&conn->mtask->running,
                                      &conn->mgmt_run_list);
+                       spin_unlock_bh(&conn->session->lock);
                        if (tt->xmit_mgmt_task(conn, conn->mtask))
                                goto again;
                }
@@ -568,8 +570,10 @@ static int iscsi_data_xmit(struct iscsi_conn *conn)
                 * iscsi tcp may readd the task to the xmitqueue to send
                 * write data
                 */
+               spin_lock_bh(&conn->session->lock);
                if (list_empty(&conn->ctask->running))
                        list_add_tail(&conn->ctask->running, &conn->run_list);
+               spin_unlock_bh(&conn->session->lock);
                if (tt->xmit_cmd_task(conn, conn->ctask))
                        goto again;
        }
@@ -580,8 +584,10 @@ static int iscsi_data_xmit(struct iscsi_conn *conn)
         if (unlikely(__kfifo_len(conn->mgmtqueue))) {
                while (__kfifo_get(conn->mgmtqueue, (void*)&conn->mtask,
                                   sizeof(void*))) {
+                       spin_lock_bh(&conn->session->lock);
                        list_add_tail(&conn->mtask->running,
                                      &conn->mgmt_run_list);
+                       spin_unlock_bh(&conn->session->lock);
                        if (tt->xmit_mgmt_task(conn, conn->mtask))
                                goto again;
                }