[SCSI] libiscsi: don't call into lld to cleanup task
authorMike Christie <michaelc@cs.wisc.edu>
Thu, 31 Aug 2006 22:09:34 +0000 (18:09 -0400)
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>
Sat, 2 Sep 2006 18:37:40 +0000 (13:37 -0500)
In the normal IO path we should not be calling back
into the LLD since the LLD will have cleaned up the
task before or after calling complete pdu.

For the fail_command path we still need to do this
to force the cleanup.

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

index 12b5c18..c542d0e 100644 (file)
@@ -213,12 +213,8 @@ static void iscsi_get_ctask(struct iscsi_cmd_task *ctask)
 
 static void __iscsi_put_ctask(struct iscsi_cmd_task *ctask)
 {
-       struct iscsi_conn *conn = ctask->conn;
-
-       if (atomic_dec_and_test(&ctask->refcount)) {
-               conn->session->tt->cleanup_cmd_task(conn, ctask);
+       if (atomic_dec_and_test(&ctask->refcount))
                iscsi_complete_command(ctask);
-       }
 }
 
 static void iscsi_put_ctask(struct iscsi_cmd_task *ctask)
@@ -1129,10 +1125,13 @@ static void fail_command(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask,
        sc = ctask->sc;
        if (!sc)
                return;
+
+       conn->session->tt->cleanup_cmd_task(conn, ctask);
        iscsi_ctask_mtask_cleanup(ctask);
 
        sc->result = err;
        sc->resid = sc->request_bufflen;
+       /* release ref from queuecommand */
        __iscsi_put_ctask(ctask);
 }