]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[SCSI] iscsi_tcp: return a descriptive error value during connection errors
authorMike Christie <michaelc@cs.wisc.edu>
Wed, 24 Sep 2008 16:46:13 +0000 (11:46 -0500)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Mon, 13 Oct 2008 13:29:00 +0000 (09:29 -0400)
The segment->done functions return a iscsi error value which gives
a lot more info than conn failed, so this patch has us return
that value. I also add a new one for xmit failures.

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

index 4f096de81525d16d990aa8982debbbacab73a524..ed6c54cae7b14a132c19241859470559c4a6b7aa 100644 (file)
@@ -979,7 +979,7 @@ iscsi_tcp_recv(read_descriptor_t *rd_desc, struct sk_buff *skb,
 
 error:
        debug_tcp("Error receiving PDU, errno=%d\n", rc);
-       iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED);
+       iscsi_conn_failure(conn, rc);
        return 0;
 }
 
@@ -1098,8 +1098,10 @@ iscsi_xmit(struct iscsi_conn *conn)
 
        while (1) {
                rc = iscsi_tcp_xmit_segment(tcp_conn, segment);
-               if (rc < 0)
+               if (rc < 0) {
+                       rc = ISCSI_ERR_XMIT_FAILED;
                        goto error;
+               }
                if (rc == 0)
                        break;
 
@@ -1108,7 +1110,7 @@ iscsi_xmit(struct iscsi_conn *conn)
                if (segment->total_copied >= segment->total_size) {
                        if (segment->done != NULL) {
                                rc = segment->done(tcp_conn, segment);
-                               if (rc < 0)
+                               if (rc != 0)
                                        goto error;
                        }
                }
@@ -1123,8 +1125,8 @@ error:
        /* Transmit error. We could initiate error recovery
         * here. */
        debug_tcp("Error sending PDU, errno=%d\n", rc);
-       iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED);
-       return rc;
+       iscsi_conn_failure(conn, rc);
+       return -EIO;
 }
 
 /**
index f274d248a91f4e3cf600ea1404779b9411b849c9..0c9514de5df7d8f9e514e14f32d8e9d1c2709a80 100644 (file)
@@ -214,6 +214,7 @@ enum iscsi_err {
        ISCSI_ERR_PARAM_NOT_FOUND       = ISCSI_ERR_BASE + 16,
        ISCSI_ERR_NO_SCSI_CMD           = ISCSI_ERR_BASE + 17,
        ISCSI_ERR_INVALID_HOST          = ISCSI_ERR_BASE + 18,
+       ISCSI_ERR_XMIT_FAILED           = ISCSI_ERR_BASE + 19,
 };
 
 /*