]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/suse-2.6.27.39/patches.fixes/iscsi_tcp-propogate-EAGAIN-from-sendpage-to-libiscsi
Fix oinkmaster patch.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.fixes / iscsi_tcp-propogate-EAGAIN-from-sendpage-to-libiscsi
CommitLineData
82094b55
AF
1From: Hannes Reinecke <hare@suse.de>
2Date: Tue, 18 Aug 2009 10:01:42 +0200
3Subject: iscsi_tcp: propogate EAGAIN from sendpage to libiscsi
4References: bnc#472432
5X-Git: 32382492eb18e8e20be382a1743d0c08469d1e84
6
7The net layer might return -EAGAIN because it could not
8get space/mem within the sock sndtimeo or becuase the tcp/ip
9connection was down. For the latter we do not want to retry
10because the conn/session should just be shutdown and restarted.
11libiscsi knows the state of the session recovery so propogate
12this error to that layer. It will either do iscsi recovery
13or have us retry the operation. Right now if we have partially
14sent a pdu we would always retry the IO xmit slowing down
15recovery.
16
17Backported to SLES11.
18
19Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
20Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
21Signed-off-by: Hannes Reinecke <hare@suse.de>
22---
23 drivers/scsi/iscsi_tcp.c | 14 +++++++++-----
24 1 files changed, 9 insertions(+), 5 deletions(-)
25
26diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
27index 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--
611.6.0.2
62