aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/iscsi_tcp.c
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2006-05-02 20:46:49 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-05-10 11:13:44 -0400
commit665b44aee34e9f2c64558df4ec01d40576e45651 (patch)
tree2ac5ff4b706f45c0259bdd9ecbe18d792255f109 /drivers/scsi/iscsi_tcp.c
parent8d2860b3c3e933304f49171770658c00ed26fd79 (diff)
[SCSI] iscsi: dequeue all buffers from queue
debugged by wrwhitehead@novell.com patch and analysis by fujita.tomonori@lab.ntt.co.jp Only tcp_read_sock and recv_actor (iscsi_tcp_data_recv for us) see desc.count. It is is used just for permitting tcp_read_sock to read the portion of data in the socket. When iscsi_tcp_data_recv sees a partial header, it sets desc.count. However, it is possible that the next skb (containing the rest of the header) still does not come. So I'm not sure that this scheme is completely correct. Ideally, we should use the exact length of the data in the socket for desc.count. However, it is not so simple (see SIOCINQ in tcp_ioctl). So I think that iscsi_tcp_data_recv can just stop playing with desc.count and tell tcp_read_sock to read the all skbs. As proposed already, if iscsi_tcp_data_ready sets desc.count to non-zero, tcp_read_sock does that. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/iscsi_tcp.c')
-rw-r--r--drivers/scsi/iscsi_tcp.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index c0ce6ab81a9d..d94038eafb9b 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -922,11 +922,8 @@ more:
922 922
923 rc = iscsi_data_recv(conn); 923 rc = iscsi_data_recv(conn);
924 if (rc) { 924 if (rc) {
925 if (rc == -EAGAIN) { 925 if (rc == -EAGAIN)
926 rd_desc->count = tcp_conn->in.datalen -
927 tcp_conn->in.ctask->data_count;
928 goto again; 926 goto again;
929 }
930 iscsi_conn_failure(conn, rc); 927 iscsi_conn_failure(conn, rc);
931 return 0; 928 return 0;
932 } 929 }
@@ -983,9 +980,14 @@ iscsi_tcp_data_ready(struct sock *sk, int flag)
983 980
984 read_lock(&sk->sk_callback_lock); 981 read_lock(&sk->sk_callback_lock);
985 982
986 /* use rd_desc to pass 'conn' to iscsi_tcp_data_recv */ 983 /*
984 * Use rd_desc to pass 'conn' to iscsi_tcp_data_recv.
985 * We set count to 1 because we want the network layer to
986 * hand us all the skbs that are available. iscsi_tcp_data_recv
987 * handled pdus that cross buffers or pdus that still need data.
988 */
987 rd_desc.arg.data = conn; 989 rd_desc.arg.data = conn;
988 rd_desc.count = 0; 990 rd_desc.count = 1;
989 tcp_read_sock(sk, &rd_desc, iscsi_tcp_data_recv); 991 tcp_read_sock(sk, &rd_desc, iscsi_tcp_data_recv);
990 992
991 read_unlock(&sk->sk_callback_lock); 993 read_unlock(&sk->sk_callback_lock);