Commit 6f481e3c authored by Mike Christie's avatar Mike Christie Committed by James Bottomley

[SCSI] iscsi_tcp: return a descriptive error value during connection errors

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: default avatarMike Christie <michaelc@cs.wisc.edu>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent 8e124525
...@@ -979,7 +979,7 @@ iscsi_tcp_recv(read_descriptor_t *rd_desc, struct sk_buff *skb, ...@@ -979,7 +979,7 @@ iscsi_tcp_recv(read_descriptor_t *rd_desc, struct sk_buff *skb,
error: error:
debug_tcp("Error receiving PDU, errno=%d\n", rc); debug_tcp("Error receiving PDU, errno=%d\n", rc);
iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED); iscsi_conn_failure(conn, rc);
return 0; return 0;
} }
...@@ -1098,8 +1098,10 @@ iscsi_xmit(struct iscsi_conn *conn) ...@@ -1098,8 +1098,10 @@ iscsi_xmit(struct iscsi_conn *conn)
while (1) { while (1) {
rc = iscsi_tcp_xmit_segment(tcp_conn, segment); rc = iscsi_tcp_xmit_segment(tcp_conn, segment);
if (rc < 0) if (rc < 0) {
rc = ISCSI_ERR_XMIT_FAILED;
goto error; goto error;
}
if (rc == 0) if (rc == 0)
break; break;
...@@ -1108,7 +1110,7 @@ iscsi_xmit(struct iscsi_conn *conn) ...@@ -1108,7 +1110,7 @@ iscsi_xmit(struct iscsi_conn *conn)
if (segment->total_copied >= segment->total_size) { if (segment->total_copied >= segment->total_size) {
if (segment->done != NULL) { if (segment->done != NULL) {
rc = segment->done(tcp_conn, segment); rc = segment->done(tcp_conn, segment);
if (rc < 0) if (rc != 0)
goto error; goto error;
} }
} }
...@@ -1123,8 +1125,8 @@ iscsi_xmit(struct iscsi_conn *conn) ...@@ -1123,8 +1125,8 @@ iscsi_xmit(struct iscsi_conn *conn)
/* Transmit error. We could initiate error recovery /* Transmit error. We could initiate error recovery
* here. */ * here. */
debug_tcp("Error sending PDU, errno=%d\n", rc); debug_tcp("Error sending PDU, errno=%d\n", rc);
iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED); iscsi_conn_failure(conn, rc);
return rc; return -EIO;
} }
/** /**
......
...@@ -214,6 +214,7 @@ enum iscsi_err { ...@@ -214,6 +214,7 @@ enum iscsi_err {
ISCSI_ERR_PARAM_NOT_FOUND = ISCSI_ERR_BASE + 16, ISCSI_ERR_PARAM_NOT_FOUND = ISCSI_ERR_BASE + 16,
ISCSI_ERR_NO_SCSI_CMD = ISCSI_ERR_BASE + 17, ISCSI_ERR_NO_SCSI_CMD = ISCSI_ERR_BASE + 17,
ISCSI_ERR_INVALID_HOST = ISCSI_ERR_BASE + 18, ISCSI_ERR_INVALID_HOST = ISCSI_ERR_BASE + 18,
ISCSI_ERR_XMIT_FAILED = ISCSI_ERR_BASE + 19,
}; };
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment