]>
Commit | Line | Data |
---|---|---|
82094b55 AF |
1 | From: Hannes Reinecke <hare@suse.de> |
2 | Date: Tue, 18 Aug 2009 10:01:42 +0200 | |
3 | Subject: iscsi_tcp: propogate EAGAIN from sendpage to libiscsi | |
4 | References: bnc#472432 | |
5 | X-Git: 32382492eb18e8e20be382a1743d0c08469d1e84 | |
6 | ||
7 | The net layer might return -EAGAIN because it could not | |
8 | get space/mem within the sock sndtimeo or becuase the tcp/ip | |
9 | connection was down. For the latter we do not want to retry | |
10 | because the conn/session should just be shutdown and restarted. | |
11 | libiscsi knows the state of the session recovery so propogate | |
12 | this error to that layer. It will either do iscsi recovery | |
13 | or have us retry the operation. Right now if we have partially | |
14 | sent a pdu we would always retry the IO xmit slowing down | |
15 | recovery. | |
16 | ||
17 | Backported to SLES11. | |
18 | ||
19 | Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> | |
20 | Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com> | |
21 | Signed-off-by: Hannes Reinecke <hare@suse.de> | |
22 | --- | |
23 | drivers/scsi/iscsi_tcp.c | 14 +++++++++----- | |
24 | 1 files changed, 9 insertions(+), 5 deletions(-) | |
25 | ||
26 | diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c | |
27 | index 324e719..25094c9 100644 | |
28 | --- a/drivers/scsi/iscsi_tcp.c | |
29 | +++ b/drivers/scsi/iscsi_tcp.c | |
30 | @@ -317,8 +317,6 @@ iscsi_tcp_xmit_segment(struct iscsi_tcp_conn *tcp_conn, | |
31 | ||
32 | if (r < 0) { | |
33 | iscsi_tcp_segment_unmap(segment); | |
34 | - if (copied || r == -EAGAIN) | |
35 | - break; | |
36 | return r; | |
37 | } | |
38 | copied += r; | |
39 | @@ -1150,11 +1148,17 @@ iscsi_xmit(struct iscsi_conn *conn) | |
40 | ||
41 | while (1) { | |
42 | rc = iscsi_tcp_xmit_segment(tcp_conn, segment); | |
43 | - if (rc < 0) { | |
44 | + /* | |
45 | + * We may not have been able to send data because the conn | |
46 | + * is getting stopped. libiscsi will know so propogate err | |
47 | + * for it to do the right thing. | |
48 | + */ | |
49 | + if (rc == -EAGAIN) | |
50 | + return rc; | |
51 | + else if (rc < 0) { | |
52 | rc = ISCSI_ERR_CONN_FAILED; | |
53 | goto error; | |
54 | - } | |
55 | - if (rc == 0) | |
56 | + } else if (rc == 0) | |
57 | break; | |
58 | ||
59 | consumed += rc; | |
60 | -- | |
61 | 1.6.0.2 | |
62 |