aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2009-06-15 23:11:09 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-06-21 11:52:40 -0400
commit32382492eb18e8e20be382a1743d0c08469d1e84 (patch)
tree8b612f29d04a0ecd39c64452a601a01f687b3fcc /drivers
parentd355e57d58193b89283b0c8153649f0427b0bdad (diff)
iscsi_tcp: propogate EAGAIN from sendpage to libiscsi
The net layer might return -EAGAIN because it could not get space/mem within the sock sndtimeo or becuase the tcp/ip connection was down. For the latter we do not want to retry because the conn/session should just be shutdown and restarted. libiscsi knows the state of the session recovery so propogate this error to that layer. It will either do iscsi recovery or have us retry the operation. Right now if we have partially sent a pdu we would always retry the IO xmit slowing down recovery. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/iscsi_tcp.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index b7c092d63bbe..518dbd91df85 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -253,8 +253,6 @@ static int iscsi_sw_tcp_xmit_segment(struct iscsi_tcp_conn *tcp_conn,
253 253
254 if (r < 0) { 254 if (r < 0) {
255 iscsi_tcp_segment_unmap(segment); 255 iscsi_tcp_segment_unmap(segment);
256 if (copied || r == -EAGAIN)
257 break;
258 return r; 256 return r;
259 } 257 }
260 copied += r; 258 copied += r;
@@ -275,11 +273,17 @@ static int iscsi_sw_tcp_xmit(struct iscsi_conn *conn)
275 273
276 while (1) { 274 while (1) {
277 rc = iscsi_sw_tcp_xmit_segment(tcp_conn, segment); 275 rc = iscsi_sw_tcp_xmit_segment(tcp_conn, segment);
278 if (rc < 0) { 276 /*
277 * We may not have been able to send data because the conn
278 * is getting stopped. libiscsi will know so propogate err
279 * for it to do the right thing.
280 */
281 if (rc == -EAGAIN)
282 return rc;
283 else if (rc < 0) {
279 rc = ISCSI_ERR_XMIT_FAILED; 284 rc = ISCSI_ERR_XMIT_FAILED;
280 goto error; 285 goto error;
281 } 286 } else if (rc == 0)
282 if (rc == 0)
283 break; 287 break;
284 288
285 consumed += rc; 289 consumed += rc;