Skip to content

Commit 665b44a

Browse files
Mike ChristieJames Bottomley
authored andcommitted
[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>
1 parent 8d2860b commit 665b44a

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

drivers/scsi/iscsi_tcp.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -922,11 +922,8 @@ iscsi_tcp_data_recv(read_descriptor_t *rd_desc, struct sk_buff *skb,
922922

923923
rc = iscsi_data_recv(conn);
924924
if (rc) {
925-
if (rc == -EAGAIN) {
926-
rd_desc->count = tcp_conn->in.datalen -
927-
tcp_conn->in.ctask->data_count;
925+
if (rc == -EAGAIN)
928926
goto again;
929-
}
930927
iscsi_conn_failure(conn, rc);
931928
return 0;
932929
}
@@ -983,9 +980,14 @@ iscsi_tcp_data_ready(struct sock *sk, int flag)
983980

984981
read_lock(&sk->sk_callback_lock);
985982

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+
*/
987989
rd_desc.arg.data = conn;
988-
rd_desc.count = 0;
990+
rd_desc.count = 1;
989991
tcp_read_sock(sk, &rd_desc, iscsi_tcp_data_recv);
990992

991993
read_unlock(&sk->sk_callback_lock);

0 commit comments

Comments
 (0)