]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
libiscsi: fix locking in iscsi_eh_device_reset
authorMike Christie <michaelc@cs.wisc.edu>
Wed, 24 Sep 2008 16:46:15 +0000 (11:46 -0500)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Mon, 13 Oct 2008 13:29:01 +0000 (09:29 -0400)
We must be using the bh spin locking functions in
iscsi_eh_device_reset becuase the session lock interacts with
a thread and softirq.

This patch also fixes up a bogus comment and check in fail_command,
because no one drops the lock (bnx2i did but it is not going
upstream yet and there were other refcount changes for that).

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

index 5aa0db150436c06f8ea608ded00d5aa40885ff38..801c7cf54d2ebb29b209fbd692eb7c807514fdc6 100644 (file)
@@ -404,11 +404,6 @@ static void fail_command(struct iscsi_conn *conn, struct iscsi_task *task,
                conn->session->queued_cmdsn--;
        else
                conn->session->tt->cleanup_task(conn, task);
-       /*
-        * Check if cleanup_task dropped the lock and the command completed,
-        */
-       if (!task->sc)
-               return;
 
        sc->result = err;
        if (!scsi_bidi_cmnd(sc))
@@ -1829,10 +1824,10 @@ int iscsi_eh_device_reset(struct scsi_cmnd *sc)
 
        iscsi_suspend_tx(conn);
 
-       spin_lock(&session->lock);
+       spin_lock_bh(&session->lock);
        fail_all_commands(conn, sc->device->lun, DID_ERROR);
        conn->tmf_state = TMF_INITIAL;
-       spin_unlock(&session->lock);
+       spin_unlock_bh(&session->lock);
 
        iscsi_start_tx(conn);
        goto done;